#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*/ Delay_ms(int);
scalar_t__ EEPROM_Read(int);
int /*<<< orphan*/ EEPROM_Write(int, char);
int /*<<< orphan*/ IntToStr(int, char *);
int /*<<< orphan*/ UART1_Init(int);
int /*<<< orphan*/ UART1_Write_Text(char *);
int /*<<< orphan*/ UART_Write(char);
void main(void) {
  char rom_data[7];
  UART1_Init(9600);
  UART1_Write_Text("mikroC EEPROM TEST\n");
  EEPROM_Write(0, '1');
  Delay_ms(20);
  EEPROM_Write(1, '2');
  Delay_ms(20);
  EEPROM_Write(2, '3');
  Delay_ms(20);
  IntToStr((int)EEPROM_Read(0), rom_data);
  UART1_Write_Text("EEPROM Data : ");
  UART1_Write_Text(rom_data);
  UART_Write('\n');
  Delay_ms(20);
  IntToStr((int)EEPROM_Read(1), rom_data);
  UART1_Write_Text("EEPROM Data : ");
  UART1_Write_Text(rom_data);
  UART_Write('\n');
  Delay_ms(20);
  IntToStr((int)EEPROM_Read(2), rom_data);
  UART1_Write_Text("EEPROM Data : ");
  UART1_Write_Text(rom_data);
  UART_Write('\n');
  Delay_ms(20);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2580,%edi
call   1050 <UART1_Init@plt>
lea    0xe77(%rip),%rdi
call   1060 <UART1_Write_Text@plt>
xor    %edi,%edi
mov    $0x31,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x1,%edi
mov    $0x32,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x2,%edi
mov    $0x33,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
xor    %edi,%edi
call   1040 <EEPROM_Read@plt>
mov    %eax,%edi
lea    -0x7(%rbp),%rsi
call   1080 <IntToStr@plt>
lea    0xe25(%rip),%rdi
call   1060 <UART1_Write_Text@plt>
lea    -0x7(%rbp),%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x1,%edi
call   1040 <EEPROM_Read@plt>
mov    %eax,%edi
lea    -0x7(%rbp),%rsi
call   1080 <IntToStr@plt>
lea    0xde7(%rip),%rdi
call   1060 <UART1_Write_Text@plt>
lea    -0x7(%rbp),%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x2,%edi
call   1040 <EEPROM_Read@plt>
mov    %eax,%edi
lea    -0x7(%rbp),%rsi
call   1080 <IntToStr@plt>
lea    0xda9(%rip),%rdi
call   1060 <UART1_Write_Text@plt>
lea    -0x7(%rbp),%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
jmp    128d <main+0x11d>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2580,%edi
call   1050 <UART1_Init@plt>
lea    0xe7b(%rip),%rdi
call   1060 <UART1_Write_Text@plt>
xor    %edi,%edi
mov    $0x31,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x1,%edi
mov    $0x32,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x2,%edi
mov    $0x33,%esi
call   1070 <EEPROM_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
xor    %edi,%edi
call   1040 <EEPROM_Read@plt>
lea    0x1(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1080 <IntToStr@plt>
lea    0xe25(%rip),%r14
mov    %r14,%rdi
call   1060 <UART1_Write_Text@plt>
mov    %rbx,%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x1,%edi
call   1040 <EEPROM_Read@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1080 <IntToStr@plt>
mov    %r14,%rdi
call   1060 <UART1_Write_Text@plt>
mov    %rbx,%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
mov    $0x2,%edi
call   1040 <EEPROM_Read@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1080 <IntToStr@plt>
mov    %r14,%rdi
call   1060 <UART1_Write_Text@plt>
mov    %rbx,%rdi
call   1060 <UART1_Write_Text@plt>
mov    $0xa,%edi
call   1030 <UART_Write@plt>
mov    $0x14,%edi
call   1090 <Delay_ms@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1290 <main+0x120>

LLVM IR (-O0):
@.str = [20 x i8] c"mikroC EEPROM TEST\0A\00"
@.str.1 = [15 x i8] c"EEPROM Data : \00"
define void @main() {
%1 = alloca [7 x i8]
%2 = call i32 @UART1_Init(i32 9600)
%3 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @EEPROM_Write(i32 0, i8 signext 49)
%5 = call i32 @Delay_ms(i32 20)
%6 = call i32 @EEPROM_Write(i32 1, i8 signext 50)
%7 = call i32 @Delay_ms(i32 20)
%8 = call i32 @EEPROM_Write(i32 2, i8 signext 51)
%9 = call i32 @Delay_ms(i32 20)
%10 = call i64 @EEPROM_Read(i32 0)
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%13 = call i32 @IntToStr(i32 %11, i8* %12)
%14 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%16 = call i32 @UART1_Write_Text(i8* %15)
%17 = call i32 @UART_Write(i8 signext 10)
%18 = call i32 @Delay_ms(i32 20)
%19 = call i64 @EEPROM_Read(i32 1)
%20 = trunc i64 %19 to i32
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%22 = call i32 @IntToStr(i32 %20, i8* %21)
%23 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%25 = call i32 @UART1_Write_Text(i8* %24)
%26 = call i32 @UART_Write(i8 signext 10)
%27 = call i32 @Delay_ms(i32 20)
%28 = call i64 @EEPROM_Read(i32 2)
%29 = trunc i64 %28 to i32
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%31 = call i32 @IntToStr(i32 %29, i8* %30)
%32 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%34 = call i32 @UART1_Write_Text(i8* %33)
%35 = call i32 @UART_Write(i8 signext 10)
%36 = call i32 @Delay_ms(i32 20)
br label %37
37: ; preds = %0, %37
br label %37
}

LLVM IR (-O2):
@.str = [20 x i8] c"mikroC EEPROM TEST\0A\00"
@.str.1 = [15 x i8] c"EEPROM Data : \00"
define void @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @UART1_Init(i32 9600)
%4 = tail call i32 @UART1_Write_Text(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @EEPROM_Write(i32 0, i8 signext 49)
%6 = tail call i32 @Delay_ms(i32 20)
%7 = tail call i32 @EEPROM_Write(i32 1, i8 signext 50)
%8 = tail call i32 @Delay_ms(i32 20)
%9 = tail call i32 @EEPROM_Write(i32 2, i8 signext 51)
%10 = tail call i32 @Delay_ms(i32 20)
%11 = tail call i64 @EEPROM_Read(i32 0)
%12 = trunc i64 %11 to i32
%13 = call i32 @IntToStr(i32 %12, i8* %2)
%14 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @UART1_Write_Text(i8* %2)
%16 = call i32 @UART_Write(i8 signext 10)
%17 = call i32 @Delay_ms(i32 20)
%18 = call i64 @EEPROM_Read(i32 1)
%19 = trunc i64 %18 to i32
%20 = call i32 @IntToStr(i32 %19, i8* %2)
%21 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @UART1_Write_Text(i8* %2)
%23 = call i32 @UART_Write(i8 signext 10)
%24 = call i32 @Delay_ms(i32 20)
%25 = call i64 @EEPROM_Read(i32 2)
%26 = trunc i64 %25 to i32
%27 = call i32 @IntToStr(i32 %26, i8* %2)
%28 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @UART1_Write_Text(i8* %2)
%30 = call i32 @UART_Write(i8 signext 10)
%31 = call i32 @Delay_ms(i32 20)
br label %32
32: ; preds = %32, %0
br label %32
}