#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 checkdata();
int checkstatus();
scalar_t__ close();
int continueclipping();
int /*<<< orphan*/ displaystatus();
int /*<<< orphan*/ goodbye();
int /*<<< orphan*/ resetstatus();
scalar_t__ restart();
int /*<<< orphan*/ welcome();
int main() {
  int alldone = 0;
  welcome();
  do {
    if (checkdata() == 1) {
      resetstatus();
    }
    do {
      if (checkstatus() == 1) {
        if (restart()) {
          break;
        }
      }
      displaystatus();
      alldone = continueclipping();
    } while (alldone == 0);
    resetstatus();
    goodbye();
  } while (close() == 0);
  return 0;
}


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   1080 <welcome@plt>
mov    $0x0,%al
call   1050 <checkdata@plt>
cmp    $0x1,%eax
jne    11c4 <main+0x34>
mov    $0x0,%al
call   10a0 <resetstatus@plt>
jmp    11c9 <main+0x39>
mov    $0x0,%al
call   1090 <checkstatus@plt>
cmp    $0x1,%eax
jne    11f4 <main+0x64>
mov    $0x0,%al
call   1030 <restart@plt>
cmp    $0x0,%rax
je     11ef <main+0x5f>
jmp    120f <main+0x7f>
jmp    11f4 <main+0x64>
mov    $0x0,%al
call   1040 <displaystatus@plt>
mov    $0x0,%al
call   10b0 <continueclipping@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11c9 <main+0x39>
mov    $0x0,%al
call   10a0 <resetstatus@plt>
mov    $0x0,%al
call   1070 <goodbye@plt>
mov    $0x0,%al
call   1060 <close@plt>
cmp    $0x0,%rax
je     11ad <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <welcome@plt>
jmp    11ba <main+0x2a>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <resetstatus@plt>
xor    %eax,%eax
call   1070 <goodbye@plt>
xor    %eax,%eax
call   1060 <close@plt>
test   %rax,%rax
jne    11fc <main+0x6c>
xor    %eax,%eax
call   1050 <checkdata@plt>
cmp    $0x1,%eax
jne    11e2 <main+0x52>
xor    %eax,%eax
call   10a0 <resetstatus@plt>
jmp    11e2 <main+0x52>
nop
xor    %eax,%eax
call   1040 <displaystatus@plt>
xor    %eax,%eax
call   10b0 <continueclipping@plt>
test   %eax,%eax
jne    11a0 <main+0x10>
xor    %eax,%eax
call   1090 <checkstatus@plt>
cmp    $0x1,%eax
jne    11d0 <main+0x40>
xor    %eax,%eax
call   1030 <restart@plt>
test   %rax,%rax
je     11d0 <main+0x40>
jmp    11a0 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @welcome()
br label %4
4: ; preds = %27, %0
%5 = call i32 (...) @checkdata()
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = call i32 (...) @resetstatus()
br label %9
9: ; preds = %7, %4
br label %10
10: ; preds = %21, %9
%11 = call i32 (...) @checkstatus()
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = call i64 (...) @restart()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
br label %24
17: ; preds = %13
br label %18
18: ; preds = %17, %10
%19 = call i32 (...) @displaystatus()
%20 = call i32 (...) @continueclipping()
store i32 %20, i32* %2
br label %21
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 0
br i1 %23, label %10, label %24
24: ; preds = %21, %16
%25 = call i32 (...) @resetstatus()
%26 = call i32 (...) @goodbye()
br label %27
27: ; preds = %24
%28 = call i64 (...) @close()
%29 = icmp eq i64 %28, 0
br i1 %29, label %4, label %30
30: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @welcome()
br label %2
2: ; preds = %18, %0
%3 = tail call i32 (...) @checkdata()
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @resetstatus()
br label %7
7: ; preds = %5, %2
br label %8
8: ; preds = %7, %14
%9 = tail call i32 (...) @checkstatus()
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = tail call i64 (...) @restart()
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11, %8
%15 = tail call i32 (...) @displaystatus()
%16 = tail call i32 (...) @continueclipping()
%17 = icmp eq i32 %16, 0
br i1 %17, label %8, label %18
18: ; preds = %11, %14
%19 = tail call i32 (...) @resetstatus()
%20 = tail call i32 (...) @goodbye()
%21 = tail call i64 (...) @close()
%22 = icmp eq i64 %21, 0
br i1 %22, label %2, label %23
23: ; preds = %18
ret i32 0
}