#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*/ connected();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ test_create_already_exists();
int /*<<< orphan*/ test_open_create();
int /*<<< orphan*/ test_open_enoent_failures();
int /*<<< orphan*/ test_open_exist();
int main(void) {
  int result = 0;
  while (!connected()) {
    printf("Waiting for tsumufs to mount.\n");
    sleep(1);
  }
  printf("Mounted.\n");
  sleep(1);
  if (!test_open_enoent_failures())
    result = 1;
  if (!test_open_create())
    result = 1;
  if (!test_open_exist())
    result = 1;
  if (!test_create_already_exists())
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <connected@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a2 <main+0x32>
jmp    11bd <main+0x4d>
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
jmp    1186 <main+0x16>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    $0x0,%al
call   1080 <test_open_enoent_failures@plt>
cmp    $0x0,%eax
jne    11ea <main+0x7a>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_open_create@plt>
cmp    $0x0,%eax
jne    1201 <main+0x91>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_open_exist@plt>
cmp    $0x0,%eax
jne    1218 <main+0xa8>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_create_already_exists@plt>
cmp    $0x0,%eax
jne    122f <main+0xbf>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <connected@plt>
test   %eax,%eax
jne    11ad <main+0x3d>
lea    0xe83(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
xor    %eax,%eax
call   1050 <connected@plt>
test   %eax,%eax
je     1190 <main+0x20>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
xor    %eax,%eax
call   1080 <test_open_enoent_failures@plt>
test   %eax,%eax
sete   %bpl
xor    %eax,%eax
call   1040 <test_open_create@plt>
test   %eax,%eax
sete   %bl
xor    %eax,%eax
call   1070 <test_open_exist@plt>
test   %eax,%eax
sete   %r14b
xor    %eax,%eax
call   1060 <test_create_already_exists@plt>
test   %eax,%eax
sete   %al
or     %r14b,%al
or     %bpl,%bl
or     %al,%bl
movzbl %bl,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Waiting for tsumufs to mount.\0A\00"
@.str.1 = [10 x i8] c"Mounted.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @connected()
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @sleep(i32 1)
br label %3
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @sleep(i32 1)
%13 = call i32 (...) @test_open_enoent_failures()
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %10
store i32 1, i32* %2
br label %16
16: ; preds = %15, %10
%17 = call i32 (...) @test_open_create()
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16
store i32 1, i32* %2
br label %20
20: ; preds = %19, %16
%21 = call i32 (...) @test_open_exist()
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %20
store i32 1, i32* %2
br label %24
24: ; preds = %23, %20
%25 = call i32 (...) @test_create_already_exists()
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %24
store i32 1, i32* %2
br label %28
28: ; preds = %27, %24
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@str = [9 x i8] c"Mounted.\00"
@str.2 = [30 x i8] c"Waiting for tsumufs to mount.\00"
define i32 @main() {
%1 = tail call i32 (...) @connected()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0, %3
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 (...) @connected()
%7 = icmp eq i32 %6, 0
br i1 %7, label %3, label %8
8: ; preds = %3, %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 (...) @test_open_enoent_failures()
%12 = icmp eq i32 %11, 0
%13 = tail call i32 (...) @test_open_create()
%14 = icmp eq i32 %13, 0
%15 = tail call i32 (...) @test_open_exist()
%16 = icmp eq i32 %15, 0
%17 = tail call i32 (...) @test_create_already_exists()
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i1 true, i1 %16
%20 = select i1 %19, i1 true, i1 %14
%21 = select i1 %20, i1 true, i1 %12
%22 = zext i1 %21 to i32
ret i32 %22
}