#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*/ syscall_thread_exit();
int /*<<< orphan*/ syscall_vga_print_hex(int);
int /*<<< orphan*/ syscall_vga_print_str(char *);
void func1(int off) {
  syscall_vga_print_hex(off);
  syscall_vga_print_str("ok\n");
  for (unsigned i = 0; i < 200000; ++i) {
    if (i % 5000 == 0)
      syscall_vga_print_str("-");
  }
  syscall_vga_print_str("exit\n");
  syscall_thread_exit();
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <syscall_vga_print_hex@plt>
lea    0xeb6(%rip),%rdi
call   1050 <syscall_vga_print_str@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x30d40,-0x8(%rbp)
jae    1197 <func1+0x67>
mov    -0x8(%rbp),%eax
mov    $0x1388,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1184 <func1+0x54>
lea    0xe85(%rip),%rdi
call   1050 <syscall_vga_print_str@plt>
jmp    1189 <func1+0x59>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <func1+0x26>
lea    0xe68(%rip),%rdi
call   1050 <syscall_vga_print_str@plt>
mov    $0x0,%al
call   1040 <syscall_thread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
call   1030 <syscall_vga_print_hex@plt>
lea    0xebd(%rip),%rdi
call   1050 <syscall_vga_print_str@plt>
xor    %ebp,%ebp
mov    $0xd1b71759,%r15d
lea    0xead(%rip),%r14
xor    %ebx,%ebx
jmp    116e <func1+0x3e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
cmp    $0xfffcf2c0,%ebp
je     118c <func1+0x5c>
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x2c,%rax
imul   $0xffffec78,%eax,%eax
cmp    %ebp,%eax
jne    1160 <func1+0x30>
mov    %r14,%rdi
call   1050 <syscall_vga_print_str@plt>
jmp    1160 <func1+0x30>
lea    0xe73(%rip),%rdi
call   1050 <syscall_vga_print_str@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <syscall_thread_exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ok\0A\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [6 x i8] c"exit\0A\00"
define void @func1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @syscall_vga_print_hex(i32 %4)
%6 = call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %17, %1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 200000
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %3
%12 = urem i32 %11, 5000
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add i32 %18, 1
store i32 %19, i32* %3
br label %7
20: ; preds = %7
%21 = call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @syscall_thread_exit()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ok\0A\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [6 x i8] c"exit\0A\00"
define void @func1(i32 %0) {
%2 = tail call i32 @syscall_vga_print_hex(i32 %0)
%3 = tail call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %7
4: ; preds = %13
%5 = tail call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (...) @syscall_thread_exit()
ret void
7: ; preds = %1, %13
%8 = phi i32 [ 0, %1 ], [ %14, %13 ]
%9 = urem i32 %8, 5000
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @syscall_vga_print_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %7, %11
%14 = add nuw nsw i32 %8, 1
%15 = icmp eq i32 %14, 200000
br i1 %15, label %4, label %7
}