xref: /llvm-project/lldb/test/API/commands/command/script/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <cstdlib>
10 #include <cstring>
11 #include <string>
12 #include <fstream>
13 #include <iostream>
14 
15 int
16 product (int x, int y)
17 {
18     int result = x * y;
19     return result;
20 }
21 
22 int
23 sum (int a, int b)
24 {
25     int result = a + b;
26     return result;
27 }
28 
29 int
30 strange_max (int m, int n)
31 {
32     if (m > n)
33         return m;
34     else if (n > m)
35         return n;
36     else
37         return 0;
38 }
39 
40 int
41 foo (int i, int j)
42 {
43     if (strange_max (i, j) == i)
44         return product (i, j);
45     else if (strange_max  (i, j) == j)
46         return sum (i, j);
47     else
48         return product (sum (i, i), sum (j, j));
49 }
50 
51 int
52 main(int argc, char const *argv[])
53 {
54 
55     int array[9];
56 	memset(array,0,9*sizeof(int));
57 
58     array[0] = foo (1238, 78392);
59     array[1] = foo (379265, 23674);
60     array[2] = foo (872934, 234);
61     array[3] = foo (1238, 78392);
62     array[4] = foo (379265, 23674);
63     array[5] = foo (872934, 234);
64     array[6] = foo (1238, 78392);
65     array[7] = foo (379265, 23674);
66     array[8] = foo (872934, 234);
67 
68     return 0;
69 }
70