#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*/ dowhile();
int /*<<< orphan*/ kb_wait_1();
int /*<<< orphan*/ printf(char *);
int main(void) {
  int i = 1;
  kb_wait_1();
  if (0) {
  yeah:
    printf("yeah\n");
  } else {
    printf("boo\n");
  }
  if (i--)
    goto yeah;
  i = 1;
  if (0) {
    while (i--) {
      printf("once\n");
    enterloop:
      printf("twice\n");
    }
  }
  if (i >= 0)
    goto enterloop;
  i = ({
    int j = 1;
    if (0) {
      while (j--) {
        printf("SEonce\n");
      enterexprloop:
        printf("SEtwice\n");
      }
    }
    if (j >= 0)
      goto enterexprloop;
    j;
  });
  i = 1;
  if (0) {
    for (i = 1; i--;) {
      printf("once2\n");
    enterloop2:
      printf("twice2\n");
    }
  }
  if (i > 0)
    goto enterloop2;
  i = 1;
  if (0) {
    do {
      printf("once3\n");
    enterloop3:
      printf("twice3\n");
    } while (i--);
  }
  if (i > 0)
    goto enterloop3;
  i = 41;
  switch (i) {
    if (0) {
      printf("error\n");
    case 42:
      printf("error2\n");
    case 41:
      printf("caseok\n");
    }
  }
  i = 41;
  switch (i) {
    if (0) {
      printf("error3\n");
    default:
      printf("caseok2\n");
      break;
    case 42:
      printf("error4\n");
    }
  }
  dowhile();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <kb_wait_1@plt>
xor    %eax,%eax
test   $0x1,%al
jne    115c <main+0x2c>
jmp    1172 <main+0x42>
jmp    1161 <main+0x31>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <main+0x4e>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1197 <main+0x67>
jmp    1161 <main+0x31>
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11ad <main+0x7d>
jmp    11e8 <main+0xb8>
jmp    11b2 <main+0x82>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11e3 <main+0xb3>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <main+0x82>
jmp    11e8 <main+0xb8>
cmpl   $0x0,-0x8(%rbp)
jl     11f7 <main+0xc7>
jmp    11d2 <main+0xa2>
movl   $0x1,-0xc(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    120d <main+0xdd>
jmp    1248 <main+0x118>
jmp    1212 <main+0xe2>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1243 <main+0x113>
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
lea    0xdda(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xe2>
jmp    1248 <main+0x118>
cmpl   $0x0,-0xc(%rbp)
jl     1257 <main+0x127>
jmp    1232 <main+0x102>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1279 <main+0x149>
jmp    12b6 <main+0x186>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     12b1 <main+0x181>
lea    0xd81(%rip),%rdi
call   1030 <printf@plt>
lea    0xd7c(%rip),%rdi
call   1030 <printf@plt>
jmp    1280 <main+0x150>
jmp    12b6 <main+0x186>
cmpl   $0x0,-0x8(%rbp)
jle    12c5 <main+0x195>
jmp    12a0 <main+0x170>
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    12db <main+0x1ab>
jmp    1311 <main+0x1e1>
jmp    12e0 <main+0x1b0>
lea    0xd44(%rip),%rdi
call   1030 <printf@plt>
lea    0xd3f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jne    12e0 <main+0x1b0>
jmp    1311 <main+0x1e1>
cmpl   $0x0,-0x8(%rbp)
jle    1320 <main+0x1f0>
jmp    12ec <main+0x1bc>
movl   $0x29,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x29,%eax
je     1358 <main+0x228>
jmp    133b <main+0x20b>
mov    -0x14(%rbp),%eax
sub    $0x2a,%eax
jne    1369 <main+0x239>
jmp    134c <main+0x21c>
lea    0xcee(%rip),%rdi
call   1030 <printf@plt>
lea    0xcea(%rip),%rdi
call   1030 <printf@plt>
jmp    1369 <main+0x239>
movl   $0x29,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2a,%eax
je     1392 <main+0x262>
jmp    1381 <main+0x251>
lea    0xcd1(%rip),%rdi
call   1030 <printf@plt>
jmp    13a3 <main+0x273>
lea    0xcc9(%rip),%rdi
call   1030 <printf@plt>
jmp    13a3 <main+0x273>
mov    $0x0,%al
call   1050 <dowhile@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <kb_wait_1@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe53(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <dowhile@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"yeah\0A\00"
@.str.1 = [5 x i8] c"boo\0A\00"
@.str.2 = [6 x i8] c"once\0A\00"
@.str.3 = [7 x i8] c"twice\0A\00"
@.str.4 = [8 x i8] c"SEonce\0A\00"
@.str.5 = [9 x i8] c"SEtwice\0A\00"
@.str.6 = [7 x i8] c"once2\0A\00"
@.str.7 = [8 x i8] c"twice2\0A\00"
@.str.8 = [7 x i8] c"once3\0A\00"
@.str.9 = [8 x i8] c"twice3\0A\00"
@.str.10 = [7 x i8] c"error\0A\00"
@.str.11 = [8 x i8] c"error2\0A\00"
@.str.12 = [8 x i8] c"caseok\0A\00"
@.str.13 = [8 x i8] c"error3\0A\00"
@.str.14 = [9 x i8] c"caseok2\0A\00"
@.str.15 = [8 x i8] c"error4\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%5 = call i32 (...) @kb_wait_1()
br i1 false, label %6, label %9
6: ; preds = %0
br label %7
7: ; preds = %15, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %16
15: ; preds = %11
br label %7
16: ; preds = %11
store i32 1, i32* %2
br i1 false, label %17, label %27
17: ; preds = %16
br label %18
18: ; preds = %24, %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, -1
store i32 %20, i32* %2
%21 = icmp ne i32 %19, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %30, %22
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %18
26: ; preds = %18
br label %27
27: ; preds = %26, %16
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %24
31: ; preds = %27
store i32 1, i32* %3
br i1 false, label %32, label %42
32: ; preds = %31
br label %33
33: ; preds = %39, %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
%36 = icmp ne i32 %34, 0
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %45, %37
%40 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %33
41: ; preds = %33
br label %42
42: ; preds = %41, %31
%43 = load i32, i32* %3
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %42
br label %39
46: ; preds = %42
%47 = load i32, i32* %3
store i32 %47, i32* %4
%48 = load i32, i32* %4
store i32 %48, i32* %2
store i32 1, i32* %2
br i1 false, label %49, label %59
49: ; preds = %46
store i32 1, i32* %2
br label %50
50: ; preds = %56, %49
%51 = load i32, i32* %2
%52 = add nsw i32 %51, -1
store i32 %52, i32* %2
%53 = icmp ne i32 %51, 0
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %62, %54
%57 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %50
58: ; preds = %50
br label %59
59: ; preds = %58, %46
%60 = load i32, i32* %2
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %59
br label %56
63: ; preds = %59
store i32 1, i32* %2
br i1 false, label %64, label %74
64: ; preds = %63
br label %65
65: ; preds = %69, %64
%66 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %67
67: ; preds = %77, %65
%68 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i32, i32* %2
%71 = add nsw i32 %70, -1
store i32 %71, i32* %2
%72 = icmp ne i32 %70, 0
br i1 %72, label %65, label %73
73: ; preds = %69
br label %74
74: ; preds = %73, %63
%75 = load i32, i32* %2
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %74
br label %67
78: ; preds = %74
store i32 41, i32* %2
%79 = load i32, i32* %2
switch i32 %79, label %88 [
i32 42, label %83
i32 41, label %85
]
80: ; No predecessors!
br i1 false, label %81, label %87
81: ; preds = %80
%82 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %83
83: ; preds = %78, %81
%84 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %85
85: ; preds = %78, %83
%86 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
br label %87
87: ; preds = %85, %80
br label %88
88: ; preds = %87, %78
store i32 41, i32* %2
%89 = load i32, i32* %2
switch i32 %89, label %93 [
i32 42, label %95
]
90: ; No predecessors!
br i1 false, label %91, label %97
91: ; preds = %90
%92 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %93
93: ; preds = %88, %91
%94 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
br label %98
95: ; preds = %88
%96 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
br label %97
97: ; preds = %95, %90
br label %98
98: ; preds = %97, %93
%99 = call i32 (...) @dowhile()
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"boo\00"
@str.16 = [7 x i8] c"caseok\00"
@str.17 = [8 x i8] c"caseok2\00"
@str.18 = [7 x i8] c"twice3\00"
@str.19 = [6 x i8] c"once3\00"
@str.20 = [7 x i8] c"twice2\00"
@str.21 = [6 x i8] c"once2\00"
@str.22 = [8 x i8] c"SEtwice\00"
@str.23 = [7 x i8] c"SEonce\00"
@str.24 = [6 x i8] c"twice\00"
@str.25 = [5 x i8] c"once\00"
@str.26 = [5 x i8] c"yeah\00"
define i32 @main() {
%1 = tail call i32 (...) @kb_wait_1()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.26, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.24, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.25, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.24, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.22, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.23, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.22, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.20, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.20, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.18, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.19, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.18, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.16, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, i64 0, i64 0))
%18 = tail call i32 (...) @dowhile()
ret i32 0
}