#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*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int g31();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ strcmp(char *, char *);
int t31();
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int i, g, x;
  if ((argc == 2) && !strcmp(argv[1], "-g"))
    g = 1;
  else
    g = 0;
  for (i = 0; i < (128 * 1024); i++) {
    usleep(97);
    if (g)
      x = g31();
    else
      x = t31();
    assert(x > 0);
    assert(x < 32);
    putchar(x);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11b9 <main+0x49>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe61(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11b9 <main+0x49>
movl   $0x1,-0x18(%rbp)
jmp    11c0 <main+0x50>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x20000,-0x14(%rbp)
jge    1239 <main+0xc9>
mov    $0x61,%edi
call   1090 <usleep@plt>
cmpl   $0x0,-0x18(%rbp)
je     11f7 <main+0x87>
mov    $0x0,%al
call   1040 <g31@plt>
mov    %eax,-0x1c(%rbp)
jmp    1201 <main+0x91>
mov    $0x0,%al
call   1050 <t31@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x20,-0x1c(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x1c(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c7 <main+0x57>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    1192 <main+0x22>
mov    0x8(%rsi),%rdi
lea    0xe7c(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    1192 <main+0x22>
xor    %r14d,%r14d
jmp    1195 <main+0x25>
mov    $0x1,%r14b
mov    $0x20000,%ebp
jmp    11ce <main+0x5e>
nopl   0x0(%rax)
call   1050 <t31@plt>
mov    %eax,%ebx
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmp    $0x20,%ebx
setl   %dil
call   1070 <assert@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
je     11e6 <main+0x76>
mov    $0x61,%edi
call   1090 <usleep@plt>
xor    %eax,%eax
test   %r14b,%r14b
jne    11a0 <main+0x30>
call   1040 <g31@plt>
jmp    11a5 <main+0x35>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-g\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %11
store i32 1, i32* %7
br label %19
18: ; preds = %11, %2
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
store i32 0, i32* %6
br label %20
20: ; preds = %42, %19
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 131072
br i1 %22, label %23, label %45
23: ; preds = %20
%24 = call i32 @usleep(i32 97)
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (...) @g31()
store i32 %28, i32* %8
br label %31
29: ; preds = %23
%30 = call i32 (...) @t31()
store i32 %30, i32* %8
br label %31
31: ; preds = %29, %27
%32 = load i32, i32* %8
%33 = icmp sgt i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %8
%37 = icmp slt i32 %36, 32
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i32, i32* %8
%41 = call i32 @putchar(i32 %40)
br label %42
42: ; preds = %31
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %20
45: ; preds = %20
%46 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"-g\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %4, %2
br label %10
10: ; preds = %4, %9
%11 = phi i1 [ true, %9 ], [ false, %4 ]
br label %12
12: ; preds = %10, %19
%13 = phi i32 [ 0, %10 ], [ %28, %19 ]
%14 = tail call i32 @usleep(i32 97)
br i1 %11, label %17, label %15
15: ; preds = %12
%16 = tail call i32 (...) @g31()
br label %19
17: ; preds = %12
%18 = tail call i32 (...) @t31()
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
%21 = icmp sgt i32 %20, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = icmp slt i32 %20, 32
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @putchar(i32 %20)
%28 = add nuw nsw i32 %13, 1
%29 = icmp eq i32 %28, 131072
br i1 %29, label %30, label %12
30: ; preds = %19
%31 = tail call i32 @exit(i32 0)
unreachable
}