#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*/ itoa(unsigned int, char *, int);
int strlen(char *);
int /*<<< orphan*/ transmit_usart(char);
void transmit_usart_word(unsigned int data) {
  char pointer[20];
  int size;
  int i;
  itoa(data, pointer, 10);
  size = strlen(pointer);
  for (i = 0; i < size; ++i)
    transmit_usart(pointer[i]);
}


x86 assembly (clang, -O0):
<transmit_usart_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1050 <itoa@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1187 <transmit_usart_word+0x57>
movslq -0x28(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1030 <transmit_usart@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    115f <transmit_usart_word+0x2f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transmit_usart_word>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0xa,%edx
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1172 <transmit_usart_word+0x42>
mov    %eax,%r14d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1030 <transmit_usart@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1160 <transmit_usart_word+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @transmit_usart_word(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i32 @itoa(i32 %6, i8* %7, i32 10)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %21, %1
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @transmit_usart(i8 signext %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @transmit_usart_word(i32 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @itoa(i32 %0, i8* %3, i32 10)
%5 = call i32 @strlen(i8* %3)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = call i32 @transmit_usart(i8 signext %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %1
ret void
}