#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*/ Uart_Putch(int, int);
void Uart_Print(int Ch, char *UartPrintData) {
  while (*UartPrintData != '\0') {
    Uart_Putch(Ch, *UartPrintData);
    if (*UartPrintData == 0x0A)
      Uart_Putch(Ch, 0x0D);
    UartPrintData++;
  }
}


x86 assembly (clang, -O0):
<Uart_Print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116c <Uart_Print+0x5c>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <Uart_Putch@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    115b <Uart_Print+0x4b>
mov    -0x4(%rbp),%edi
mov    $0xd,%esi
call   1030 <Uart_Putch@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111f <Uart_Print+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Uart_Print>:
push   %rbp
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1159 <Uart_Print+0x49>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x1,%rbx
jmp    113b <Uart_Print+0x2b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1159 <Uart_Print+0x49>
movsbl %al,%esi
mov    %ebp,%edi
call   1030 <Uart_Putch@plt>
cmpb   $0xa,-0x1(%rbx)
jne    1130 <Uart_Print+0x20>
mov    %ebp,%edi
mov    $0xd,%esi
call   1030 <Uart_Putch@plt>
jmp    1130 <Uart_Print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @Uart_Print(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
br label %5
5: ; preds = %23, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %5
%11 = load i32, i32* %3
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 @Uart_Putch(i32 %11, i32 %14)
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %23
20: ; preds = %10
%21 = load i32, i32* %3
%22 = call i32 @Uart_Putch(i32 %21, i32 13)
br label %23
23: ; preds = %20, %10
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
br label %5
26: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @Uart_Print(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2, %14
%6 = phi i8 [ %16, %14 ], [ %3, %2 ]
%7 = phi i8* [ %15, %14 ], [ %1, %2 ]
%8 = sext i8 %6 to i32
%9 = tail call i32 @Uart_Putch(i32 %0, i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 10
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = tail call i32 @Uart_Putch(i32 %0, i32 13)
br label %14
14: ; preds = %12, %5
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %5
18: ; preds = %14, %2
ret void
}