#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 atoi(char *);
char getchar();
int max2(int, int);
int max3(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int a, b, c, i, j, k;
  char d[10], e[10], f[10];
  printf("getal 1: ");
  for (i = 0; (d[i] = getchar()) != '\n'; i++)
    ;
  d[i] = '\0';
  a = atoi(d);
  printf("getal 2: ");
  for (j = 0; (e[j] = getchar()) != '\n'; j++)
    ;
  e[j] = '\0';
  b = atoi(e);
  printf("getal 3: ");
  for (k = 0; (f[k] = getchar()) != '\n'; k++)
    ;
  f[k] = '\0';
  c = atoi(f);
  printf("maximum van 1 en 2 is: %d\n", max2(a, b));
  printf("maximum van 1 en 2 en 3 is: %d\n", max3(a, b, c));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x14(%rbp),%rcx
mov    %al,-0x26(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11a2 <main+0x52>
jmp    1194 <main+0x44>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x24>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x26(%rbp,%rax,1)
lea    -0x26(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x8(%rbp)
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x18(%rbp),%rcx
mov    %al,-0x30(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11fa <main+0xaa>
jmp    11ec <main+0x9c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cc <main+0x7c>
movslq -0x18(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0xc(%rbp)
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x1c(%rbp),%rcx
mov    %al,-0x3a(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     1252 <main+0x102>
jmp    1244 <main+0xf4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1224 <main+0xd4>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x3a(%rbp,%rax,1)
lea    -0x3a(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <max2@plt>
mov    %eax,%esi
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <max3@plt>
mov    %eax,%esi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x17(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1170 <main+0x20>
mov    %ebx,%eax
movb   $0x0,0x16(%rsp,%rax,1)
lea    0x16(%rsp),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xd(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    11b0 <main+0x60>
mov    %ebx,%eax
movb   $0x0,0xc(%rsp,%rax,1)
lea    0xc(%rsp),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x3(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    11f0 <main+0xa0>
mov    %ebx,%eax
movb   $0x0,0x2(%rsp,%rax,1)
lea    0x2(%rsp),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <max2@plt>
lea    0xdf7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1060 <max3@plt>
lea    0xdf6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"getal 1: \00"
@.str.1 = [10 x i8] c"getal 2: \00"
@.str.2 = [10 x i8] c"getal 3: \00"
@.str.3 = [27 x i8] c"maximum van 1 en 2 is: %d\0A\00"
@.str.4 = [32 x i8] c"maximum van 1 en 2 en 3 is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca [10 x i8]
%10 = alloca [10 x i8]
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %12
12: ; preds = %20, %0
%13 = call signext i8 (...) @getchar()
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 %15
store i8 %13, i8* %16
%17 = sext i8 %13 to i32
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %23
19: ; preds = %12
br label %20
20: ; preds = %19
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %12
23: ; preds = %12
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 %25
store i8 0, i8* %26
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %30
30: ; preds = %38, %23
%31 = call signext i8 (...) @getchar()
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 %33
store i8 %31, i8* %34
%35 = sext i8 %31 to i32
%36 = icmp ne i32 %35, 10
br i1 %36, label %37, label %41
37: ; preds = %30
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %30
41: ; preds = %30
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 %43
store i8 0, i8* %44
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %3
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %48
48: ; preds = %56, %41
%49 = call signext i8 (...) @getchar()
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 %51
store i8 %49, i8* %52
%53 = sext i8 %49 to i32
%54 = icmp ne i32 %53, 10
br i1 %54, label %55, label %59
55: ; preds = %48
br label %56
56: ; preds = %55
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %48
59: ; preds = %48
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 %61
store i8 0, i8* %62
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%64 = call i32 @atoi(i8* %63)
store i32 %64, i32* %4
%65 = load i32, i32* %2
%66 = load i32, i32* %3
%67 = call i32 @max2(i32 %65, i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %2
%70 = load i32, i32* %3
%71 = load i32, i32* %4
%72 = call i32 @max3(i32 %69, i32 %70, i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
@.str = [10 x i8] c"getal 1: \00"
@.str.1 = [10 x i8] c"getal 2: \00"
@.str.2 = [10 x i8] c"getal 3: \00"
@.str.3 = [27 x i8] c"maximum van 1 en 2 is: %d\0A\00"
@.str.4 = [32 x i8] c"maximum van 1 en 2 en 3 is: %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ %13, %8 ], [ 0, %0 ]
%10 = tail call signext i8 (...) @getchar()
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %9
store i8 %10, i8* %11
%12 = icmp eq i8 %10, 10
%13 = add nuw i64 %9, 1
br i1 %12, label %14, label %8
14: ; preds = %8
%15 = and i64 %9, 4294967295
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %15
store i8 0, i8* %16
%17 = call i32 @atoi(i8* %4)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %19, %14
%20 = phi i64 [ %24, %19 ], [ 0, %14 ]
%21 = tail call signext i8 (...) @getchar()
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %20
store i8 %21, i8* %22
%23 = icmp eq i8 %21, 10
%24 = add nuw i64 %20, 1
br i1 %23, label %25, label %19
25: ; preds = %19
%26 = and i64 %20, 4294967295
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %26
store i8 0, i8* %27
%28 = call i32 @atoi(i8* %5)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %30, %25
%31 = phi i64 [ %35, %30 ], [ 0, %25 ]
%32 = tail call signext i8 (...) @getchar()
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %31
store i8 %32, i8* %33
%34 = icmp eq i8 %32, 10
%35 = add nuw i64 %31, 1
br i1 %34, label %36, label %30
36: ; preds = %30
%37 = and i64 %31, 4294967295
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %37
store i8 0, i8* %38
%39 = call i32 @atoi(i8* %6)
%40 = tail call i32 @max2(i32 %17, i32 %28)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = tail call i32 @max3(i32 %17, i32 %28, i32 %39)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %42)
ret i32 0
}