#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*/ int_to_hex(unsigned int, char *);
int /*<<< orphan*/ uart_putc(char);
void uart_print_addr(unsigned int data) {
  char num[10];
  int_to_hex(data, num);
  uart_putc(num[1]);
  uart_putc(num[0]);
  uart_putc(num[3]);
  uart_putc(num[2]);
  uart_putc(num[5]);
  uart_putc(num[4]);
  uart_putc(num[7]);
  uart_putc(num[6]);
  return;
}


x86 assembly (clang, -O0):
<uart_print_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xe(%rbp),%rsi
call   1040 <int_to_hex@plt>
movsbl -0xd(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0xe(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0xb(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0xc(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0x9(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0xa(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0x7(%rbp),%edi
call   1030 <uart_putc@plt>
movsbl -0x8(%rbp),%edi
call   1030 <uart_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_print_addr>:
sub    $0x18,%rsp
lea    0xe(%rsp),%rsi
call   1040 <int_to_hex@plt>
movsbl 0xf(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0xe(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x11(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x10(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x13(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x12(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x15(%rsp),%edi
call   1030 <uart_putc@plt>
movsbl 0x14(%rsp),%edi
call   1030 <uart_putc@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @uart_print_addr(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = call i32 @int_to_hex(i32 %4, i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 1
%8 = load i8, i8* %7
%9 = call i32 @uart_putc(i8 signext %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%11 = load i8, i8* %10
%12 = call i32 @uart_putc(i8 signext %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 3
%14 = load i8, i8* %13
%15 = call i32 @uart_putc(i8 signext %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 2
%17 = load i8, i8* %16
%18 = call i32 @uart_putc(i8 signext %17)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 5
%20 = load i8, i8* %19
%21 = call i32 @uart_putc(i8 signext %20)
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 4
%23 = load i8, i8* %22
%24 = call i32 @uart_putc(i8 signext %23)
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 7
%26 = load i8, i8* %25
%27 = call i32 @uart_putc(i8 signext %26)
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 6
%29 = load i8, i8* %28
%30 = call i32 @uart_putc(i8 signext %29)
ret void
}

LLVM IR (-O2):
define void @uart_print_addr(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @int_to_hex(i32 %0, i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 1
%6 = load i8, i8* %5
%7 = call i32 @uart_putc(i8 signext %6)
%8 = load i8, i8* %3
%9 = call i32 @uart_putc(i8 signext %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 3
%11 = load i8, i8* %10
%12 = call i32 @uart_putc(i8 signext %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 2
%14 = load i8, i8* %13
%15 = call i32 @uart_putc(i8 signext %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 5
%17 = load i8, i8* %16
%18 = call i32 @uart_putc(i8 signext %17)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 4
%20 = load i8, i8* %19
%21 = call i32 @uart_putc(i8 signext %20)
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 7
%23 = load i8, i8* %22
%24 = call i32 @uart_putc(i8 signext %23)
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 6
%26 = load i8, i8* %25
%27 = call i32 @uart_putc(i8 signext %26)
ret void
}