#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int add(int, int);
double divide1(int, int);
double divide2(int, int);
int /*<<< orphan*/ greet(char *);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ sayHello();
int main(int argc, char **argv) {
  double result;
  int n1;
  int n2;
  int total;
  n1 = 10;
  n2 = 3;
  sayHello();
  greet("Fred");
  total = add(n1, n2);
  printf("%d + %d = %d\n", n1, n2, total);
  result = divide1(100, 3);
  printf("Result of 100/3 with divide1 = %f\n", result);
  result = divide2(100, 3);
  printf("Result of 100/3 with divide2 = %f\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
mov    $0x0,%al
call   1030 <sayHello@plt>
lea    0xe6e(%rip),%rdi
call   1070 <greet@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <add@plt>
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x3,%esi
call   1080 <divide1@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x3,%esi
call   1060 <divide2@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <sayHello@plt>
lea    0xe99(%rip),%rdi
call   1070 <greet@plt>
mov    $0xa,%edi
mov    $0x3,%esi
call   1040 <add@plt>
lea    0xe83(%rip),%rdi
movsd  0xe6e(%rip),%xmm0
mov    $0x3,%esi
mov    %eax,%edx
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x3,%esi
call   1080 <divide1@plt>
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x3,%esi
call   1060 <divide2@plt>
lea    0xe6b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Fred\00"
@.str.1 = [14 x i8] c"%d + %d = %d\0A\00"
@.str.2 = [35 x i8] c"Result of 100/3 with divide1 = %f\0A\00"
@.str.3 = [35 x i8] c"Result of 100/3 with divide2 = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %7
store i32 3, i32* %8
%10 = call i32 (...) @sayHello()
%11 = call i32 @greet(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @add(i32 %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %16, i32 %17, i32 %18)
%20 = call double @divide1(i32 100, i32 3)
store double %20, double* %6
%21 = load double, double* %6
%22 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %21)
%23 = call double @divide2(i32 100, i32 3)
store double %23, double* %6
%24 = load double, double* %6
%25 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"Fred\00"
@.str.1 = [14 x i8] c"%d + %d = %d\0A\00"
@.str.2 = [35 x i8] c"Result of 100/3 with divide1 = %f\0A\00"
@.str.3 = [35 x i8] c"Result of 100/3 with divide2 = %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @sayHello()
%4 = tail call i32 @greet(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @add(i32 10, i32 3)
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+01, i32 3, i32 %5)
%7 = tail call double @divide1(i32 100, i32 3)
%8 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = tail call double @divide2(i32 100, i32 3)
%10 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %9)
ret i32 0
}