#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*/ printf(char *, int, int, int, char *);
void report(int chosenDoor, int revealedDoor, int *doors) {
  int winner = -1;
  do {
    winner++;
  } while (doors[winner] != 1);
  printf("Chose: %d\tRevealed: %d\tWinning Door: %d%s\n", chosenDoor,
         revealedDoor, winner, winner == chosenDoor ? " Winner!" : "");
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1129 <report+0x19>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%r9d
lea    0xecf(%rip),%r8
lea    0xec9(%rip),%rax
cmp    %r9d,%edi
cmove  %rax,%r8
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
mov    %rdx,%rax
mov    %esi,%edx
mov    %edi,%esi
mov    $0xffffffff,%ecx
nopl   0x0(%rax)
add    $0x1,%ecx
cmpl   $0x1,(%rax)
lea    0x4(%rax),%rax
jne    1120 <report+0x10>
cmp    %ecx,%esi
lea    0xef6(%rip),%rax
lea    0xeee(%rip),%r8
cmove  %rax,%r8
lea    0xeb9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Chose: %d\09Revealed: %d\09Winning Door: %d%s\0A\00"
@.str.1 = [9 x i8] c" Winner!\00"
@.str.2 = [1 x i8] zeroinitializer
define void @report(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 -1, i32* %7
br label %8
8: ; preds = %11, %3
%9 = load i32, i32* %7
%10 = add nsw i32 %9, 1
store i32 %10, i32* %7
br label %11
11: ; preds = %8
%12 = load i32*, i32** %6
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = icmp ne i32 %16, 1
br i1 %17, label %8, label %18
18: ; preds = %11
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %4
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%27 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"Chose: %d\09Revealed: %d\09Winning Door: %d%s\0A\00"
@.str.1 = [9 x i8] c" Winner!\00"
@.str.2 = [1 x i8] zeroinitializer
define void @report(i32 %0, i32 %1, i32* nocapture %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ %6, %4 ], [ -1, %3 ]
%6 = add nsw i64 %5, 1
%7 = getelementptr inbounds i32, i32* %2, i64 %6
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
%12 = icmp eq i32 %11, %0
%13 = select i1 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %11, i8* %13)
ret void
}