#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*/ print_debug(char *);
int /*<<< orphan*/ print_debug_hex8(int);
void goto_test(void) {
  int i;
  print_debug("goto_test\n");
  i = 0;
  goto bottom;
  {
  top:
    print_debug("i = ");
    print_debug_hex8(i);
    print_debug("\n");
    i = i + 1;
  }
bottom:
  if (i < 10) {
    goto top;
  }
}


x86 assembly (clang, -O0):
<goto_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <print_debug@plt>
movl   $0x0,-0x4(%rbp)
jmp    1169 <goto_test+0x49>
lea    0xec4(%rip),%rdi
call   1040 <print_debug@plt>
mov    -0x4(%rbp),%edi
call   1030 <print_debug_hex8@plt>
lea    0xeae(%rip),%rdi
call   1040 <print_debug@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1178 <goto_test+0x58>
jmp    1140 <goto_test+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goto_test>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
call   1040 <print_debug@plt>
lea    0xed4(%rip),%r14
mov    %r14,%rdi
call   1040 <print_debug@plt>
xor    %edi,%edi
call   1030 <print_debug_hex8@plt>
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x1,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x2,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x3,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x4,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x5,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x6,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x7,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x8,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
call   1040 <print_debug@plt>
mov    %r14,%rdi
call   1040 <print_debug@plt>
mov    $0x9,%edi
call   1030 <print_debug_hex8@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_debug@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"goto_test\0A\00"
@.str.1 = [5 x i8] c"i = \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @goto_test() {
%1 = alloca i32
%2 = call i32 @print_debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %10
3: ; preds = %13
%4 = call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = call i32 @print_debug_hex8(i32 %5)
%7 = call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %10
10: ; preds = %3, %0
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %10
br label %3
14: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"goto_test\0A\00"
@.str.1 = [5 x i8] c"i = \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @goto_test() {
%1 = tail call i32 @print_debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @print_debug_hex8(i32 0)
%4 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @print_debug_hex8(i32 1)
%7 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @print_debug_hex8(i32 2)
%10 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @print_debug_hex8(i32 3)
%13 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 @print_debug_hex8(i32 4)
%16 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @print_debug_hex8(i32 5)
%19 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @print_debug_hex8(i32 6)
%22 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @print_debug_hex8(i32 7)
%25 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%27 = tail call i32 @print_debug_hex8(i32 8)
%28 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = tail call i32 @print_debug(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @print_debug_hex8(i32 9)
%31 = tail call i32 @print_debug(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}