#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_multiple_writes();
int /*<<< orphan*/ test_single_write();
int main(void) {
  int result = 0;
  while (!connected()) {
    printf("Waiting for tsumufs to mount.\n");
    sleep(1);
  }
  printf("Mounted.\n");
  sleep(1);
  if (!test_single_write())
    result = 1;
  if (!test_multiple_writes())
    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   1030 <connected@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1182 <main+0x32>
jmp    119d <main+0x4d>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1166 <main+0x16>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x0,%al
call   1050 <test_single_write@plt>
cmp    $0x0,%eax
jne    11ca <main+0x7a>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_multiple_writes@plt>
cmp    $0x0,%eax
jne    11e1 <main+0x91>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <connected@plt>
test   %eax,%eax
jne    118d <main+0x3d>
lea    0xea6(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
call   1040 <connected@plt>
test   %eax,%eax
je     1170 <main+0x20>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
call   1050 <test_single_write@plt>
test   %eax,%eax
sete   %bl
xor    %eax,%eax
call   1060 <test_multiple_writes@plt>
test   %eax,%eax
sete   %al
or     %bl,%al
movzbl %al,%eax
pop    %rbx
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_single_write()
%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_multiple_writes()
%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 = load i32, i32* %2
ret i32 %21
}

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_single_write()
%12 = icmp eq i32 %11, 0
%13 = tail call i32 (...) @test_multiple_writes()
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i1 true, i1 %12
%16 = zext i1 %15 to i32
ret i32 %16
}