#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 /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int max(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main() {
  int value;
  printf("Test max using if statement:");
  value = max(13, 14);
  if (value != 14) {
    printf(" FAILED\n");
    fprintf(stderr, "max(13,14) failed)");
    fprintf(stderr, "  result   %d\n", value);
    fprintf(stderr, "  expected %d\n", 14);
  }
  printf(" OK\n");
  printf("Test max using assert:      ");
  assert(max(13, 14) == 14);
  printf(" OK\n");
  printf("Make assert fail:          ");
  assert(max(13, 14) == 1);
  printf(" OK\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1040 <max@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xe,-0x8(%rbp)
je     11d0 <main+0x90>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
mov    $0xe,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1040 <max@plt>
cmp    $0xe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1040 <max@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1050 <max@plt>
cmp    $0xe,%eax
je     11c3 <main+0x73>
mov    %eax,%ebx
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e57(%rip),%r14
mov    (%r14),%edi
lea    0xe8a(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r14),%edi
lea    0xe8c(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%r14),%edi
lea    0xe88(%rip),%rsi
mov    $0xe,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xebd(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1050 <max@plt>
xor    %edi,%edi
cmp    $0xe,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1050 <max@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Test max using if statement:\00"
@.str.1 = [9 x i8] c" FAILED\0A\00"
@stderr = global i32 0
@.str.2 = [19 x i8] c"max(13,14) failed)\00"
@.str.3 = [15 x i8] c" result %d\0A\00"
@.str.4 = [15 x i8] c" expected %d\0A\00"
@.str.5 = [5 x i8] c" OK\0A\00"
@.str.6 = [29 x i8] c"Test max using assert: \00"
@.str.7 = [28 x i8] c"Make assert fail: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @max(i32 13, i32 14)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 14
br i1 %6, label %7, label %16
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = load i32, i32* %2
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
br label %16
16: ; preds = %7, %0
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @max(i32 13, i32 14)
%20 = icmp eq i32 %19, 14
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%25 = call i32 @max(i32 13, i32 14)
%26 = icmp eq i32 %25, 1
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Test max using if statement:\00"
@stderr = global i32 0
@.str.2 = [19 x i8] c"max(13,14) failed)\00"
@.str.3 = [15 x i8] c" result %d\0A\00"
@.str.4 = [15 x i8] c" expected %d\0A\00"
@.str.6 = [29 x i8] c"Test max using assert: \00"
@.str.7 = [28 x i8] c"Make assert fail: \00"
@str.9 = [4 x i8] c" OK\00"
@str.10 = [8 x i8] c" FAILED\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @max(i32 13, i32 14)
%3 = icmp eq i32 %2, 14
br i1 %3, label %12, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 14)
br label %12
12: ; preds = %4, %0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.9, i64 0, i64 0))
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @max(i32 13, i32 14)
%16 = icmp eq i32 %15, 14
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.9, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%21 = tail call i32 @max(i32 13, i32 14)
%22 = icmp eq i32 %21, 1
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}