#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*/ pass_doors(int *);
int /*<<< orphan*/ print_doors(int *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ test_doors(int *);
int main(int argc, char const *argv[]) {
  int doors[100];
  for (int i = 0; i <= 99; ++i)
    doors[i] = 0;
  pass_doors(doors);
  print_doors(doors);
  printf("Test: %s\n", test_doors(doors) ? "Pass" : "Fail");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x63,-0x1a4(%rbp)
jg     1196 <main+0x56>
movslq -0x1a4(%rbp),%rax
movl   $0x0,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1163 <main+0x23>
lea    -0x1a0(%rbp),%rdi
call   1040 <pass_doors@plt>
lea    -0x1a0(%rbp),%rdi
call   1050 <print_doors@plt>
lea    -0x1a0(%rbp),%rdi
call   1060 <test_doors@plt>
mov    %rax,%rcx
lea    0xe4b(%rip),%rsi
lea    0xe3f(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    %rsp,%rbx
mov    $0x190,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1050 <pass_doors@plt>
mov    %rbx,%rdi
call   1060 <print_doors@plt>
mov    %rbx,%rdi
call   1070 <test_doors@plt>
test   %rax,%rax
lea    0xe83(%rip),%rax
lea    0xe77(%rip),%rsi
cmove  %rax,%rsi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Test: %s\0A\00"
@.str.1 = [5 x i8] c"Pass\00"
@.str.2 = [5 x i8] c"Fail\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %15, %2
%9 = load i32, i32* %7
%10 = icmp sle i32 %9, 99
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %8
18: ; preds = %8
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%20 = call i32 @pass_doors(i32* %19)
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%22 = call i32 @print_doors(i32* %21)
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%24 = call i64 @test_doors(i32* %23)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Test: %s\0A\00"
@.str.1 = [5 x i8] c"Pass\00"
@.str.2 = [5 x i8] c"Fail\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i32]
%4 = bitcast [100 x i32]* %3 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%6 = call i32 @pass_doors(i32* %5)
%7 = call i32 @print_doors(i32* %5)
%8 = call i64 @test_doors(i32* %5)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}