Home | History | Annotate | Download | only in command_script
      1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #include <cstdlib>
     11 #include <cstring>
     12 #include <string>
     13 #include <fstream>
     14 #include <iostream>
     15 
     16 int
     17 product (int x, int y)
     18 {
     19     int result = x * y;
     20     return result;
     21 }
     22 
     23 int
     24 sum (int a, int b)
     25 {
     26     int result = a + b;
     27     return result;
     28 }
     29 
     30 int
     31 strange_max (int m, int n)
     32 {
     33     if (m > n)
     34         return m;
     35     else if (n > m)
     36         return n;
     37     else
     38         return 0;
     39 }
     40 
     41 int
     42 foo (int i, int j)
     43 {
     44     if (strange_max (i, j) == i)
     45         return product (i, j);
     46     else if (strange_max  (i, j) == j)
     47         return sum (i, j);
     48     else
     49         return product (sum (i, i), sum (j, j));
     50 }
     51 
     52 int
     53 main(int argc, char const *argv[])
     54 {
     55 
     56     int array[9];
     57 	memset(array,0,9*sizeof(int));
     58 
     59     array[0] = foo (1238, 78392);
     60     array[1] = foo (379265, 23674);
     61     array[2] = foo (872934, 234);
     62     array[3] = foo (1238, 78392);
     63     array[4] = foo (379265, 23674);
     64     array[5] = foo (872934, 234);
     65     array[6] = foo (1238, 78392);
     66     array[7] = foo (379265, 23674);
     67     array[8] = foo (872934, 234);
     68 
     69     return 0;
     70 }
     71