void putout(char *c) {
  char *b = c;
  while (*b != '\0') {
    while (!((*(volatile unsigned long *)0xE2900810) & (1 << 2)))
      ;
    (*(volatile unsigned long *)0xE2900820) = *b;
    b++;
  }
  while (!((*(volatile unsigned long *)0xE2900810) & (1 << 2)))
    ;
  (*(volatile unsigned long *)0xE2900820) = '\r';
  while (!((*(volatile unsigned long *)0xE2900810) & (1 << 2)))
    ;
  (*(volatile unsigned long *)0xE2900820) = '\n';
}


x86 assembly (clang, -O0):
<putout>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116d <putout+0x6d>
jmp    1125 <putout+0x25>
mov    $0xe2900810,%eax
mov    (%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1147 <putout+0x47>
jmp    114c <putout+0x4c>
jmp    1125 <putout+0x25>
mov    -0x10(%rbp),%rax
movsbq (%rax),%rcx
mov    $0xe2900820,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <putout+0x10>
jmp    1172 <putout+0x72>
mov    $0xe2900810,%eax
mov    (%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1194 <putout+0x94>
jmp    1199 <putout+0x99>
jmp    1172 <putout+0x72>
mov    $0xe2900820,%eax
movq   $0xd,(%rax)
mov    $0xe2900810,%eax
mov    (%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11c7 <putout+0xc7>
jmp    11cc <putout+0xcc>
jmp    11a5 <putout+0xa5>
mov    $0xe2900820,%eax
movq   $0xa,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putout>:
mov    $0xe2900810,%eax
mov    (%rdi),%cl
test   %cl,%cl
je     1130 <putout+0x30>
nopl   0x0(%rax,%rax,1)
testq  $0x4,(%rax)
je     1110 <putout+0x10>
movsbq %cl,%rcx
mov    %rcx,0x10(%rax)
movzbl 0x1(%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <putout+0x10>
nopl   (%rax)
testq  $0x4,(%rax)
je     1130 <putout+0x30>
movq   $0xd,0x10(%rax)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
testq  $0x4,(%rax)
je     1150 <putout+0x50>
movq   $0xa,0x10(%rax)
ret

LLVM IR (-O0):
define void @putout(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %5
br label %11
11: ; preds = %16, %10
%12 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%13 = and i64 %12, 4
%14 = icmp ne i64 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %17
16: ; preds = %11
br label %11
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i64
store volatile i64 %20, i64* inttoptr (i64 3801090080 to i64*)
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
br label %5
23: ; preds = %5
br label %24
24: ; preds = %29, %23
%25 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%26 = and i64 %25, 4
%27 = icmp ne i64 %26, 0
%28 = xor i1 %27, true
br i1 %28, label %29, label %30
29: ; preds = %24
br label %24
30: ; preds = %24
store volatile i64 13, i64* inttoptr (i64 3801090080 to i64*)
br label %31
31: ; preds = %36, %30
%32 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%33 = and i64 %32, 4
%34 = icmp ne i64 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %37
36: ; preds = %31
br label %31
37: ; preds = %31
store volatile i64 10, i64* inttoptr (i64 3801090080 to i64*)
ret void
}

LLVM IR (-O2):
define void @putout(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %14, %11 ], [ %2, %1 ]
%6 = phi i8* [ %13, %11 ], [ %0, %1 ]
br label %7
7: ; preds = %4, %7
%8 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%9 = and i64 %8, 4
%10 = icmp eq i64 %9, 0
br i1 %10, label %7, label %11
11: ; preds = %7
%12 = sext i8 %5 to i64
store volatile i64 %12, i64* inttoptr (i64 3801090080 to i64*)
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %11, %1
br label %17
17: ; preds = %16, %17
%18 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%19 = and i64 %18, 4
%20 = icmp eq i64 %19, 0
br i1 %20, label %17, label %21
21: ; preds = %17
store volatile i64 13, i64* inttoptr (i64 3801090080 to i64*)
br label %22
22: ; preds = %22, %21
%23 = load volatile i64, i64* inttoptr (i64 3801090064 to i64*)
%24 = and i64 %23, 4
%25 = icmp eq i64 %24, 0
br i1 %25, label %22, label %26
26: ; preds = %22
store volatile i64 10, i64* inttoptr (i64 3801090080 to i64*)
ret void
}