#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 candy(int *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int h1[] = {9};
  int h2[] = {8, 7, 8};
  int x;
  if (!(candy(h1, 1) == 1)) {
    printf("assert fail: %s\n", "candy 1");
    exit(-1);
  };
  if (!(candy(h2, 2) == 3)) {
    printf("assert fail: %s\n", "candy 2");
    exit(-1);
  };
  if (!(candy(h2, 3) == 5)) {
    printf("assert fail: %s\n", "candy 3");
    exit(-1);
  };
  printf("everything is fine!\n");
  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)
mov    0xeb4(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
call   1050 <candy@plt>
cmp    $0x1,%eax
je     1199 <main+0x69>
lea    0xe8f(%rip),%rdi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1050 <candy@plt>
cmp    $0x3,%eax
je     11cf <main+0x9f>
lea    0xe59(%rip),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1050 <candy@plt>
cmp    $0x5,%eax
je     1205 <main+0xd5>
lea    0xe23(%rip),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x9,0x4(%rsp)
mov    0xeb6(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xea3(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
call   1060 <candy@plt>
cmp    $0x1,%eax
jne    11b1 <main+0x71>
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1060 <candy@plt>
cmp    $0x3,%eax
jne    11c1 <main+0x81>
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1060 <candy@plt>
cmp    $0x5,%eax
jne    11d1 <main+0x91>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe54(%rip),%rdi
lea    0xe5e(%rip),%rsi
jmp    11df <main+0x9f>
lea    0xe44(%rip),%rdi
lea    0xe56(%rip),%rsi
jmp    11df <main+0x9f>
lea    0xe34(%rip),%rdi
lea    0xe4e(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@__const.main.h1 = [1 x i32] [i32 9]
@__const.main.h2 = [3 x i32] [i32 8, i32 7, i32 8]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [8 x i8] c"candy 1\00"
@.str.2 = [8 x i8] c"candy 2\00"
@.str.3 = [8 x i8] c"candy 3\00"
@.str.4 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1 x i32]
%7 = alloca [3 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [1 x i32]* %6 to i8*
%10 = bitcast [3 x i32]* %7 to i8*
%11 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
%12 = call i32 @candy(i32* %11, i32 1)
%13 = icmp eq i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%19 = call i32 @candy(i32* %18, i32 2)
%20 = icmp eq i32 %19, 3
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %17
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%26 = call i32 @candy(i32* %25, i32 3)
%27 = icmp eq i32 %26, 5
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.h2 = [3 x i32] [i32 8, i32 7, i32 8]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [8 x i8] c"candy 1\00"
@.str.2 = [8 x i8] c"candy 2\00"
@.str.3 = [8 x i8] c"candy 3\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1 x i32]
%4 = alloca [3 x i32]
%5 = bitcast [1 x i32]* %3 to i8*
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
store i32 9, i32* %6
%7 = bitcast [3 x i32]* %4 to i8*
%8 = call i32 @candy(i32* %6, i32 1)
%9 = icmp eq i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%15 = call i32 @candy(i32* %14, i32 2)
%16 = icmp eq i32 %15, 3
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %13
%21 = call i32 @candy(i32* %14, i32 3)
%22 = icmp eq i32 %21, 5
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %20
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}