#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 read_PBSwitchNum(int);
void waitForButtonPress() {
  int progress1 = read_PBSwitchNum(1);
  int progress2 = read_PBSwitchNum(2);
  int progress3 = read_PBSwitchNum(3);
  while ((progress1 != 0x0) && (progress2 != 0x0) && (progress3 != 0x0)) {
    progress1 = read_PBSwitchNum(1);
    progress2 = read_PBSwitchNum(2);
    progress3 = read_PBSwitchNum(3);
  }
}


x86 assembly (clang, -O0):
<waitForButtonPress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
je     1167 <waitForButtonPress+0x57>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1167 <waitForButtonPress+0x57>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1177 <waitForButtonPress+0x67>
jmp    11a3 <waitForButtonPress+0x93>
mov    $0x1,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,-0xc(%rbp)
jmp    113f <waitForButtonPress+0x2f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitForButtonPress>:
push   %rbp
push   %rbx
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   1030 <read_PBSwitchNum@plt>
mov    %eax,%ebx
mov    $0x3,%edi
call   1030 <read_PBSwitchNum@plt>
test   %ebp,%ebp
je     114e <waitForButtonPress+0x3e>
test   %ebx,%ebx
je     114e <waitForButtonPress+0x3e>
test   %eax,%eax
jne    1120 <waitForButtonPress+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @waitForButtonPress() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @read_PBSwitchNum(i32 1)
store i32 %4, i32* %1
%5 = call i32 @read_PBSwitchNum(i32 2)
store i32 %5, i32* %2
%6 = call i32 @read_PBSwitchNum(i32 3)
store i32 %6, i32* %3
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %13, %10, %7
%17 = phi i1 [ false, %10 ], [ false, %7 ], [ %15, %13 ]
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = call i32 @read_PBSwitchNum(i32 1)
store i32 %19, i32* %1
%20 = call i32 @read_PBSwitchNum(i32 2)
store i32 %20, i32* %2
%21 = call i32 @read_PBSwitchNum(i32 3)
store i32 %21, i32* %3
br label %7
22: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @waitForButtonPress() {
%1 = tail call i32 @read_PBSwitchNum(i32 1)
%2 = tail call i32 @read_PBSwitchNum(i32 2)
%3 = tail call i32 @read_PBSwitchNum(i32 3)
%4 = icmp ne i32 %1, 0
%5 = icmp ne i32 %2, 0
%6 = select i1 %4, i1 %5, i1 false
%7 = icmp ne i32 %3, 0
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %18
9: ; preds = %0, %9
%10 = tail call i32 @read_PBSwitchNum(i32 1)
%11 = tail call i32 @read_PBSwitchNum(i32 2)
%12 = tail call i32 @read_PBSwitchNum(i32 3)
%13 = icmp ne i32 %10, 0
%14 = icmp ne i32 %11, 0
%15 = select i1 %13, i1 %14, i1 false
%16 = icmp ne i32 %12, 0
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %9, label %18
18: ; preds = %9, %0
ret void
}