#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 */
char *mk20dx256_cpu_family();
int /*<<< orphan*/ mk20dx256_gpo_port_c_init(int);
int /*<<< orphan*/ mk20dx256_gpo_port_c_off(int);
int /*<<< orphan*/ mk20dx256_gpo_port_c_on(int);
int /*<<< orphan*/ mk20dx256_mcg_fei_24Mhz();
int /*<<< orphan*/ mk20dx256_uart0_init();
int /*<<< orphan*/ mk20dx256_uart0_write(char *);
int main() {
  mk20dx256_mcg_fei_24Mhz();
  mk20dx256_uart0_init();
  mk20dx256_uart0_write("\nSTART");
  mk20dx256_uart0_write("\nCPU family...");
  mk20dx256_uart0_write(mk20dx256_cpu_family());
  mk20dx256_gpo_port_c_init(5);
  int i = 0;
  while (1) {
    for (i = 0; i < 500000; ++i) {
    }
    mk20dx256_gpo_port_c_on(5);
    mk20dx256_uart0_write("\nLED is on");
    for (i = 0; i < 500000; ++i) {
    }
    mk20dx256_gpo_port_c_off(5);
    mk20dx256_uart0_write("\nLED is off");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <mk20dx256_mcg_fei_24Mhz@plt>
mov    $0x0,%al
call   1050 <mk20dx256_uart0_init@plt>
lea    0xe6c(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
lea    0xe67(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
mov    $0x0,%al
call   1070 <mk20dx256_cpu_family@plt>
mov    %rax,%rdi
call   1060 <mk20dx256_uart0_write@plt>
mov    $0x5,%edi
call   1040 <mk20dx256_gpo_port_c_init@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x7a120,-0x8(%rbp)
jge    11ec <main+0x7c>
jmp    11de <main+0x6e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cc <main+0x5c>
mov    $0x5,%edi
call   1080 <mk20dx256_gpo_port_c_on@plt>
lea    0xe19(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7a120,-0x8(%rbp)
jge    1229 <main+0xb9>
jmp    121b <main+0xab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1209 <main+0x99>
mov    $0x5,%edi
call   1090 <mk20dx256_gpo_port_c_off@plt>
lea    0xde7(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
jmp    11c5 <main+0x55>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <mk20dx256_mcg_fei_24Mhz@plt>
xor    %eax,%eax
call   1050 <mk20dx256_uart0_init@plt>
lea    0xe77(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
lea    0xe72(%rip),%rdi
call   1060 <mk20dx256_uart0_write@plt>
xor    %eax,%eax
call   1070 <mk20dx256_cpu_family@plt>
mov    %rax,%rdi
call   1060 <mk20dx256_uart0_write@plt>
mov    $0x5,%edi
call   1040 <mk20dx256_gpo_port_c_init@plt>
lea    0xe5c(%rip),%r14
lea    0xe60(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x5,%edi
call   1080 <mk20dx256_gpo_port_c_on@plt>
mov    %r14,%rdi
call   1060 <mk20dx256_uart0_write@plt>
mov    $0x5,%edi
call   1090 <mk20dx256_gpo_port_c_off@plt>
mov    %rbx,%rdi
call   1060 <mk20dx256_uart0_write@plt>
jmp    11d0 <main+0x60>

LLVM IR (-O0):
@.str = [7 x i8] c"\0ASTART\00"
@.str.1 = [15 x i8] c"\0ACPU family...\00"
@.str.2 = [11 x i8] c"\0ALED is on\00"
@.str.3 = [12 x i8] c"\0ALED is off\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @mk20dx256_mcg_fei_24Mhz()
%4 = call i32 (...) @mk20dx256_uart0_init()
%5 = call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = call i8* (...) @mk20dx256_cpu_family()
%8 = call i32 @mk20dx256_uart0_write(i8* %7)
%9 = call i32 @mk20dx256_gpo_port_c_init(i32 5)
store i32 0, i32* %2
br label %10
10: ; preds = %0, %28
store i32 0, i32* %2
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 500000
br i1 %13, label %14, label %18
14: ; preds = %11
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %11
18: ; preds = %11
%19 = call i32 @mk20dx256_gpo_port_c_on(i32 5)
%20 = call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %21
21: ; preds = %25, %18
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 500000
br i1 %23, label %24, label %28
24: ; preds = %21
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %21
28: ; preds = %21
%29 = call i32 @mk20dx256_gpo_port_c_off(i32 5)
%30 = call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %10
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0ASTART\00"
@.str.1 = [15 x i8] c"\0ACPU family...\00"
@.str.2 = [11 x i8] c"\0ALED is on\00"
@.str.3 = [12 x i8] c"\0ALED is off\00"
define i32 @main() {
%1 = tail call i32 (...) @mk20dx256_mcg_fei_24Mhz()
%2 = tail call i32 (...) @mk20dx256_uart0_init()
%3 = tail call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* (...) @mk20dx256_cpu_family()
%6 = tail call i32 @mk20dx256_uart0_write(i8* %5)
%7 = tail call i32 @mk20dx256_gpo_port_c_init(i32 5)
br label %8
8: ; preds = %8, %0
%9 = tail call i32 @mk20dx256_gpo_port_c_on(i32 5)
%10 = tail call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @mk20dx256_gpo_port_c_off(i32 5)
%12 = tail call i32 @mk20dx256_uart0_write(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %8
}