#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 */
unsigned int adc_get_vdd();
int /*<<< orphan*/ adc_init();
int /*<<< orphan*/ uart0_init();
int /*<<< orphan*/ uart0_puts(char *);
int main(void) {
  unsigned int Vdd;
  char buf[6];
  adc_init();
  uart0_init();
  Vdd = adc_get_vdd();
  buf[0] = '0' + Vdd / 1000;
  buf[1] = '.';
  buf[2] = '0' + (Vdd % 1000) / 100;
  buf[3] = '0' + (Vdd % 100) / 10;
  buf[4] = '0' + (Vdd % 10);
  buf[5] = '\0';
  (void)uart0_puts(buf);
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <adc_init@plt>
mov    $0x0,%al
call   1030 <uart0_init@plt>
mov    $0x0,%al
call   1040 <adc_get_vdd@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%eax
mov    %al,-0xe(%rbp)
movb   $0x2e,-0xd(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,-0xa(%rbp)
movb   $0x0,-0x9(%rbp)
lea    -0xe(%rbp),%rdi
call   1060 <uart0_puts@plt>
jmp    11d8 <main+0x98>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <adc_init@plt>
xor    %eax,%eax
call   1030 <uart0_init@plt>
xor    %eax,%eax
call   1040 <adc_get_vdd@plt>
mov    %eax,%ecx
imul   $0x10624dd3,%rcx,%rdx
shr    $0x26,%rdx
lea    0x30(%rdx),%esi
mov    %sil,0x2(%rsp)
movb   $0x2e,0x3(%rsp)
imul   $0x3e8,%edx,%edx
mov    %eax,%esi
sub    %edx,%esi
movzwl %si,%edx
shr    $0x2,%edx
imul   $0x147b,%edx,%edx
shr    $0x11,%edx
or     $0x30,%dl
mov    %dl,0x4(%rsp)
imul   $0x51eb851f,%rcx,%rdx
shr    $0x25,%rdx
imul   $0x64,%edx,%edx
mov    %eax,%esi
sub    %edx,%esi
imul   $0xcd,%esi,%edx
movzwl %dx,%edx
shr    $0xb,%edx
or     $0x30,%dl
mov    %dl,0x5(%rsp)
mov    $0xcccccccd,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%ecx
sub    %ecx,%eax
or     $0x30,%al
mov    %al,0x6(%rsp)
movb   $0x0,0x7(%rsp)
lea    0x2(%rsp),%rdi
call   1060 <uart0_puts@plt>
xchg   %ax,%ax
jmp    11e0 <main+0xa0>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x i8]
store i32 0, i32* %1
%4 = call i32 (...) @adc_init()
%5 = call i32 (...) @uart0_init()
%6 = call i32 (...) @adc_get_vdd()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = udiv i32 %7, 1000
%9 = add i32 48, %8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
store i8 %10, i8* %11
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 1
store i8 46, i8* %12
%13 = load i32, i32* %2
%14 = urem i32 %13, 1000
%15 = udiv i32 %14, 100
%16 = add i32 48, %15
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 2
store i8 %17, i8* %18
%19 = load i32, i32* %2
%20 = urem i32 %19, 100
%21 = udiv i32 %20, 10
%22 = add i32 48, %21
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 3
store i8 %23, i8* %24
%25 = load i32, i32* %2
%26 = urem i32 %25, 10
%27 = add i32 48, %26
%28 = trunc i32 %27 to i8
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 4
store i8 %28, i8* %29
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 5
store i8 0, i8* %30
%31 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%32 = call i32 @uart0_puts(i8* %31)
br label %33
33: ; preds = %33, %0
br label %33
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @adc_init()
%4 = tail call i32 (...) @uart0_init()
%5 = tail call i32 (...) @adc_get_vdd()
%6 = udiv i32 %5, 1000
%7 = trunc i32 %6 to i8
%8 = add i8 %7, 48
store i8 %8, i8* %2
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
store i8 46, i8* %9
%10 = urem i32 %5, 1000
%11 = trunc i32 %10 to i16
%12 = udiv i16 %11, 100
%13 = trunc i16 %12 to i8
%14 = or i8 %13, 48
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
store i8 %14, i8* %15
%16 = urem i32 %5, 100
%17 = trunc i32 %16 to i8
%18 = udiv i8 %17, 10
%19 = or i8 %18, 48
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
store i8 %19, i8* %20
%21 = urem i32 %5, 10
%22 = trunc i32 %21 to i8
%23 = or i8 %22, 48
%24 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
store i8 %23, i8* %24
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
store i8 0, i8* %25
%26 = call i32 @uart0_puts(i8* %2)
br label %27
27: ; preds = %27, %0
br label %27
}