#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*/ GLUT_BITMAP_9_BY_15;
int /*<<< orphan*/ glColor3d(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glRasterPos3d(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, int /*<<< orphan*/);
void renderText(char *x) {
  glColor3d(1, 0, 0);
  glRasterPos3d(0, 0, -100);
  while ((*x) != '\0')
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, *x++);
}


x86 assembly (clang, -O0):
<renderText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <glColor3d@plt>
xor    %esi,%esi
mov    $0xffffff9c,%edx
mov    %esi,%edi
call   1050 <glRasterPos3d@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118d <renderText+0x5d>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
jmp    1158 <renderText+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<renderText>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <glColor3d@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0xffffff9c,%edx
call   1050 <glRasterPos3d@plt>
mov    (%rbx),%al
test   %al,%al
je     1186 <renderText+0x56>
add    $0x1,%rbx
mov    0x2e84(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%esi
mov    (%r14),%edi
call   1030 <glutBitmapCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <renderText+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@GLUT_BITMAP_9_BY_15 = global i32 0
define void @renderText(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @glColor3d(i32 1, i32 0, i32 0)
%4 = call i32 @glRasterPos3d(i32 0, i32 0, i32 -100)
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i32, i32* @GLUT_BITMAP_9_BY_15
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
%16 = call i32 @glutBitmapCharacter(i32 %11, i32 %15)
br label %5
17: ; preds = %5
ret void
}

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