#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*/ ADC_Read(int /*<<< orphan*/);
int /*<<< orphan*/ Delay_ms(int);
int /*<<< orphan*/ IntToHex(int /*<<< orphan*/, char *);
int /*<<< orphan*/ UART1_Init(int);
int /*<<< orphan*/ UART1_Write_Text(char *);
void main() {
  char string[10];
  UART1_Init(9600);
  Delay_ms(100);
  UART1_Write_Text("ADC read:\r\n");
  while (1) {
    Delay_ms(1000);
    IntToHex(ADC_Read(0), string);
    UART1_Write_Text(string);
    UART1_Write_Text("\r\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2580,%edi
call   1030 <UART1_Init@plt>
mov    $0x64,%edi
call   1070 <Delay_ms@plt>
lea    0xe8d(%rip),%rdi
call   1050 <UART1_Write_Text@plt>
mov    $0x3e8,%edi
call   1070 <Delay_ms@plt>
xor    %edi,%edi
call   1040 <ADC_Read@plt>
mov    %eax,%edi
lea    -0xa(%rbp),%rsi
call   1060 <IntToHex@plt>
lea    -0xa(%rbp),%rdi
call   1050 <UART1_Write_Text@plt>
lea    0xe65(%rip),%rdi
call   1050 <UART1_Write_Text@plt>
jmp    1178 <main+0x28>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x2580,%edi
call   1030 <UART1_Init@plt>
mov    $0x64,%edi
call   1070 <Delay_ms@plt>
lea    0xe8e(%rip),%rdi
call   1050 <UART1_Write_Text@plt>
lea    0xe(%rsp),%rbx
lea    0xe86(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x3e8,%edi
call   1070 <Delay_ms@plt>
xor    %edi,%edi
call   1040 <ADC_Read@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <IntToHex@plt>
mov    %rbx,%rdi
call   1050 <UART1_Write_Text@plt>
mov    %r14,%rdi
call   1050 <UART1_Write_Text@plt>
jmp    1190 <main+0x40>

LLVM IR (-O0):
@.str = [12 x i8] c"ADC read:\0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @main() {
%1 = alloca [10 x i8]
%2 = call i32 @UART1_Init(i32 9600)
%3 = call i32 @Delay_ms(i32 100)
%4 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = call i32 @Delay_ms(i32 1000)
%7 = call i32 @ADC_Read(i32 0)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%9 = call i32 @IntToHex(i32 %7, i8* %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%11 = call i32 @UART1_Write_Text(i8* %10)
%12 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %5
}

LLVM IR (-O2):
@.str = [12 x i8] c"ADC read:\0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @UART1_Init(i32 9600)
%4 = tail call i32 @Delay_ms(i32 100)
%5 = tail call i32 @UART1_Write_Text(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = call i32 @Delay_ms(i32 1000)
%8 = call i32 @ADC_Read(i32 0)
%9 = call i32 @IntToHex(i32 %8, i8* %2)
%10 = call i32 @UART1_Write_Text(i8* %2)
%11 = call i32 @UART1_Write_Text(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %6
}