void UART0_SendString(char *string) {
  int index;
  for (index = 0; string[index] != '\0' && (index < 250); index++) {
    while ((*((volatile unsigned long *)0x7F005018)) & (1 << 14))
      ;
    (*((volatile unsigned char *)0x7F005020)) = string[index];
  }
}


x86 assembly (clang, -O0):
<UART0_SendString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     1136 <UART0_SendString+0x36>
cmpl   $0xfa,-0xc(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1146 <UART0_SendString+0x46>
jmp    1188 <UART0_SendString+0x88>
jmp    114b <UART0_SendString+0x4b>
mov    $0x7f005018,%eax
mov    (%rax),%rax
and    $0x4000,%rax
cmp    $0x0,%rax
je     1168 <UART0_SendString+0x68>
jmp    114b <UART0_SendString+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    $0x7f005020,%eax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <UART0_SendString+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<UART0_SendString>:
mov    (%rdi),%al
test   %al,%al
je     113e <UART0_SendString+0x3e>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
testq  $0x4000,0x7f005018
jne    1110 <UART0_SendString+0x10>
mov    %al,0x7f005020
movzbl 0x1(%rdi,%rcx,1),%eax
test   %al,%al
je     113e <UART0_SendString+0x3e>
lea    0x1(%rcx),%rdx
cmp    $0xf9,%rcx
mov    %rdx,%rcx
jb     1110 <UART0_SendString+0x10>
ret

LLVM IR (-O0):
define void @UART0_SendString(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %29, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 250
br label %15
15: ; preds = %12, %4
%16 = phi i1 [ false, %4 ], [ %14, %12 ]
br i1 %16, label %17, label %32
17: ; preds = %15
br label %18
18: ; preds = %22, %17
%19 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%20 = and i64 %19, 16384
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %18
23: ; preds = %18
%24 = load i8*, i8** %2
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
store volatile i8 %28, i8* inttoptr (i64 2130726944 to i8*)
br label %29
29: ; preds = %23
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %4
32: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @UART0_SendString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %11
%5 = phi i64 [ %12, %11 ], [ 0, %1 ]
%6 = phi i8 [ %14, %11 ], [ %2, %1 ]
br label %7
7: ; preds = %4, %7
%8 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%9 = and i64 %8, 16384
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7
store volatile i8 %6, i8* inttoptr (i64 2130726944 to i8*)
%12 = add nuw nsw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
%16 = icmp ult i64 %5, 249
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %4, label %18
18: ; preds = %11, %1
ret void
}