#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 UART0_GetChar();
int /*<<< orphan*/ UART0_Port_Init();
int /*<<< orphan*/ UART0_PutChar(char);
int /*<<< orphan*/ UART0_SendData32(int);
int /*<<< orphan*/ UART0_SendData8(int);
int /*<<< orphan*/ UART0_SendString(char *);
int /*<<< orphan*/ UART0_Set_BaudRate();
int /*<<< orphan*/ UART0_Set_Format();
int main() {
  char data;
  UART0_Port_Init();
  UART0_Set_BaudRate();
  UART0_Set_Format();
  UART0_SendString("Hello World!\n\r");
  UART0_SendString("Send Data 8:");
  UART0_SendString("\n\r");
  UART0_SendData8(123);
  UART0_SendString("\n\r");
  UART0_SendData8(0xFF);
  UART0_SendString("\n\r");
  UART0_SendString("Send Data 32:");
  UART0_SendString("\n\r");
  UART0_SendData32(0x1234);
  UART0_SendString("\n\r");
  UART0_SendData32(0x1234ABCD);
  UART0_SendString("\n\r");
  UART0_SendData32(0xABCD);
  UART0_SendString("\n\r");
  UART0_SendData32(0x1234ABCD);
  UART0_SendString("\n\r");
  UART0_SendData32(0x1);
  UART0_SendString("\n\r");
  while (1) {
    data = UART0_GetChar();
    UART0_PutChar(data + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <UART0_Port_Init@plt>
mov    $0x0,%al
call   1080 <UART0_Set_BaudRate@plt>
mov    $0x0,%al
call   1090 <UART0_Set_Format@plt>
lea    0xe55(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe58(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe49(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x7b,%edi
call   1050 <UART0_SendData8@plt>
lea    0xe33(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0xff,%edi
call   1050 <UART0_SendData8@plt>
lea    0xe1d(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe21(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe05(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234,%edi
call   1060 <UART0_SendData32@plt>
lea    0xdef(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234abcd,%edi
call   1060 <UART0_SendData32@plt>
lea    0xdd9(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0xabcd,%edi
call   1060 <UART0_SendData32@plt>
lea    0xdc3(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234abcd,%edi
call   1060 <UART0_SendData32@plt>
lea    0xdad(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1,%edi
call   1060 <UART0_SendData32@plt>
lea    0xd97(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    $0x0,%al
call   10a0 <UART0_GetChar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movsbl %al,%edi
call   1030 <UART0_PutChar@plt>
jmp    127a <main+0xfa>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <UART0_Port_Init@plt>
xor    %eax,%eax
call   1080 <UART0_Set_BaudRate@plt>
xor    %eax,%eax
call   1090 <UART0_Set_Format@plt>
lea    0xe63(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe66(%rip),%rdi
call   1070 <UART0_SendString@plt>
lea    0xe57(%rip),%rbx
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0x7b,%edi
call   1050 <UART0_SendData8@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0xff,%edi
call   1050 <UART0_SendData8@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
lea    0xe34(%rip),%rdi
call   1070 <UART0_SendString@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234,%edi
call   1060 <UART0_SendData32@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234abcd,%edi
call   1060 <UART0_SendData32@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0xabcd,%edi
call   1060 <UART0_SendData32@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1234abcd,%edi
call   1060 <UART0_SendData32@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
mov    $0x1,%edi
call   1060 <UART0_SendData32@plt>
mov    %rbx,%rdi
call   1070 <UART0_SendString@plt>
nop
xor    %eax,%eax
call   10a0 <UART0_GetChar@plt>
add    $0x1,%al
movsbl %al,%edi
call   1030 <UART0_PutChar@plt>
jmp    1250 <main+0xd0>

LLVM IR (-O0):
@.str = [15 x i8] c"Hello World!\0A\0D\00"
@.str.1 = [13 x i8] c"Send Data 8:\00"
@.str.2 = [3 x i8] c"\0A\0D\00"
@.str.3 = [14 x i8] c"Send Data 32:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @UART0_Port_Init()
%4 = call i32 (...) @UART0_Set_BaudRate()
%5 = call i32 (...) @UART0_Set_Format()
%6 = call i32 @UART0_SendString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @UART0_SendString(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @UART0_SendData8(i32 123)
%10 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @UART0_SendData8(i32 255)
%12 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @UART0_SendString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @UART0_SendData32(i32 4660)
%16 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @UART0_SendData32(i32 305441741)
%18 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @UART0_SendData32(i32 43981)
%20 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @UART0_SendData32(i32 305441741)
%22 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @UART0_SendData32(i32 1)
%24 = call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %0, %25
%26 = call signext i8 (...) @UART0_GetChar()
store i8 %26, i8* %2
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = add nsw i32 %28, 1
%30 = trunc i32 %29 to i8
%31 = call i32 @UART0_PutChar(i8 signext %30)
br label %25
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello World!\0A\0D\00"
@.str.1 = [13 x i8] c"Send Data 8:\00"
@.str.2 = [3 x i8] c"\0A\0D\00"
@.str.3 = [14 x i8] c"Send Data 32:\00"
define i32 @main() {
%1 = tail call i32 (...) @UART0_Port_Init()
%2 = tail call i32 (...) @UART0_Set_BaudRate()
%3 = tail call i32 (...) @UART0_Set_Format()
%4 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @UART0_SendData8(i32 123)
%8 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @UART0_SendData8(i32 255)
%10 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @UART0_SendData32(i32 4660)
%14 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @UART0_SendData32(i32 305441741)
%16 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @UART0_SendData32(i32 43981)
%18 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @UART0_SendData32(i32 305441741)
%20 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = tail call i32 @UART0_SendData32(i32 1)
%22 = tail call i32 @UART0_SendString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %23, %0
%24 = tail call signext i8 (...) @UART0_GetChar()
%25 = add i8 %24, 1
%26 = tail call i32 @UART0_PutChar(i8 signext %25)
br label %23
}