#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*/ console_init();
int /*<<< orphan*/ console_write(char *, int);
int /*<<< orphan*/ set_act_state(int);
int /*<<< orphan*/ wait(int);
int main(void) {
  int i;
  console_init();
  for (i = 0; i < 5; i++) {
    set_act_state(1);
    wait(0xf000);
    set_act_state(0);
    wait(0xf000);
  }
  console_write("hello world!", 12);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <console_init@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    119a <main+0x5a>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x1d>
lea    0xe5f(%rip),%rdi
mov    $0xc,%esi
call   1050 <console_write@plt>
jmp    11ab <main+0x6b>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <console_init@plt>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
mov    $0x1,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
xor    %edi,%edi
call   1040 <set_act_state@plt>
mov    $0xf000,%edi
call   1060 <wait@plt>
lea    0xdf8(%rip),%rdi
mov    $0xc,%esi
call   1050 <console_write@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1220 <main+0xe0>

LLVM IR (-O0):
@.str = [13 x i8] c"hello world!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @console_init()
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i32 @set_act_state(i32 1)
%9 = call i32 @wait(i32 61440)
%10 = call i32 @set_act_state(i32 0)
%11 = call i32 @wait(i32 61440)
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
%16 = call i32 @console_write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
br label %17
17: ; preds = %15, %17
br label %17
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello world!\00"
define i32 @main() {
%1 = tail call i32 (...) @console_init()
%2 = tail call i32 @set_act_state(i32 1)
%3 = tail call i32 @wait(i32 61440)
%4 = tail call i32 @set_act_state(i32 0)
%5 = tail call i32 @wait(i32 61440)
%6 = tail call i32 @set_act_state(i32 1)
%7 = tail call i32 @wait(i32 61440)
%8 = tail call i32 @set_act_state(i32 0)
%9 = tail call i32 @wait(i32 61440)
%10 = tail call i32 @set_act_state(i32 1)
%11 = tail call i32 @wait(i32 61440)
%12 = tail call i32 @set_act_state(i32 0)
%13 = tail call i32 @wait(i32 61440)
%14 = tail call i32 @set_act_state(i32 1)
%15 = tail call i32 @wait(i32 61440)
%16 = tail call i32 @set_act_state(i32 0)
%17 = tail call i32 @wait(i32 61440)
%18 = tail call i32 @set_act_state(i32 1)
%19 = tail call i32 @wait(i32 61440)
%20 = tail call i32 @set_act_state(i32 0)
%21 = tail call i32 @wait(i32 61440)
%22 = tail call i32 @console_write(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
br label %23
23: ; preds = %23, %0
br label %23
}