void print_message(const char *string) {
  register int count, loop;
  for (count = 0; string[count]; count++) {
    if (string[count] == '\n') {
      *(char *)0xbd000020 = '\r';
    }
    *(char *)0xbd000020 = string[count];
    for (loop = 0; loop < 2000; loop++) {
    }
  }
}


x86 assembly (clang, -O0):
<print_message>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     118a <print_message+0x8a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    113e <print_message+0x3e>
mov    $0xbd000020,%eax
movb   $0xd,(%rax)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    $0xbd000020,%eax
mov    %cl,(%rax)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7d0,-0x10(%rbp)
jge    1177 <print_message+0x77>
jmp    1169 <print_message+0x69>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <print_message+0x57>
jmp    117c <print_message+0x7c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <print_message+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message>:
mov    $0xbd000020,%eax
jmp    111c <print_message+0x1c>
nopw   0x0(%rax,%rax,1)
movb   $0xd,(%rax)
movzbl (%rdi),%ecx
mov    %cl,(%rax)
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0xa,%cl
je     1110 <print_message+0x10>
test   %cl,%cl
jne    1116 <print_message+0x16>
ret

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

LLVM IR (-O2):
define void @print_message(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ %10, %8 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %11
i8 10, label %6
]
6: ; preds = %2
store i8 13, i8* inttoptr (i64 3170893856 to i8*)
%7 = load i8, i8* %4
br label %8
8: ; preds = %2, %6
%9 = phi i8 [ %5, %2 ], [ %7, %6 ]
store i8 %9, i8* inttoptr (i64 3170893856 to i8*)
%10 = add nuw i64 %3, 1
br label %2
11: ; preds = %2
ret void
}