#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 Get32(int);
int /*<<< orphan*/ Set32(int, unsigned int);
void uart_send_str(const char *data) {
  if (*data == 0) {
    return;
  }
  do {
    while ((Get32(0x20201018u) & (1u << 5u)) != 0u)
      ;
    Set32(0x20201000u, (unsigned int)*(data++));
  } while (*data != 0);
  while ((Get32(0x20201018u) & (1u << 5u)) != 0u)
    ;
}


x86 assembly (clang, -O0):
<uart_send_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1141 <uart_send_str+0x21>
jmp    11b2 <uart_send_str+0x92>
jmp    1146 <uart_send_str+0x26>
jmp    114b <uart_send_str+0x2b>
mov    $0x20201018,%edi
call   1030 <Get32@plt>
and    $0x20,%eax
cmp    $0x0,%eax
je     1166 <uart_send_str+0x46>
jmp    114b <uart_send_str+0x2b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%esi
mov    $0x20201000,%edi
call   1040 <Set32@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1146 <uart_send_str+0x26>
jmp    1197 <uart_send_str+0x77>
mov    $0x20201018,%edi
call   1030 <Get32@plt>
and    $0x20,%eax
cmp    $0x0,%eax
je     11b2 <uart_send_str+0x92>
jmp    1197 <uart_send_str+0x77>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_send_str>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     116e <uart_send_str+0x4e>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x20201018,%edi
call   1030 <Get32@plt>
test   $0x20,%al
jne    1130 <uart_send_str+0x10>
lea    0x1(%rbx),%r14
movsbl (%rbx),%esi
mov    $0x20201000,%edi
call   1040 <Set32@plt>
cmpb   $0x0,0x1(%rbx)
mov    %r14,%rbx
jne    1130 <uart_send_str+0x10>
nopl   0x0(%rax,%rax,1)
mov    $0x20201018,%edi
call   1030 <Get32@plt>
test   $0x20,%al
jne    1160 <uart_send_str+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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