#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int main() {
  int i;
  for (i = 0; i < 10; i++) {
    printf("tick\n");
    fflush(stdout);
    sleep(1);
  }
  printf("BOOM!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1182 <main+0x52>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x2e96(%rip),%r14
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xdb3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"tick\0A\00"
@stdout = global i32 0
@.str.1 = [7 x i8] c"BOOM!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
%10 = call i32 @sleep(i32 1)
br label %11
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [6 x i8] c"BOOM!\00"
@str.2 = [5 x i8] c"tick\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = tail call i32 @sleep(i32 1)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = tail call i32 @fflush(i32 %14)
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%18 = load i32, i32* @stdout
%19 = tail call i32 @fflush(i32 %18)
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = tail call i32 @fflush(i32 %22)
%24 = tail call i32 @sleep(i32 1)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%26 = load i32, i32* @stdout
%27 = tail call i32 @fflush(i32 %26)
%28 = tail call i32 @sleep(i32 1)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%30 = load i32, i32* @stdout
%31 = tail call i32 @fflush(i32 %30)
%32 = tail call i32 @sleep(i32 1)
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%34 = load i32, i32* @stdout
%35 = tail call i32 @fflush(i32 %34)
%36 = tail call i32 @sleep(i32 1)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
%38 = load i32, i32* @stdout
%39 = tail call i32 @fflush(i32 %38)
%40 = tail call i32 @sleep(i32 1)
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}