#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*/ glRasterPos2i(int, int);
int /*<<< orphan*/ glutBitmapCharacter(void *, char);
void renderText(int stringPosX, int stringPosY, void *font, char *string) {
  char *stringChar;
  glRasterPos2i(stringPosX, stringPosY);
  for (stringChar = string; *stringChar != '\0'; stringChar++) {
    glutBitmapCharacter(font, *stringChar);
  }
}


x86 assembly (clang, -O0):
<renderText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glRasterPos2i@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117a <renderText+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1149 <renderText+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<renderText>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
call   1040 <glRasterPos2i@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <renderText+0x36>
add    $0x1,%rbx
nopl   0x0(%rax)
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <glutBitmapCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <renderText+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @renderText(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @glRasterPos2i(i32 %10, i32 %11)
%13 = load i8*, i8** %8
store i8* %13, i8** %9
br label %14
14: ; preds = %24, %4
%15 = load i8*, i8** %9
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = load i8*, i8** %9
%22 = load i8, i8* %21
%23 = call i32 @glutBitmapCharacter(i8* %20, i8 signext %22)
br label %24
24: ; preds = %19
%25 = load i8*, i8** %9
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %9
br label %14
27: ; preds = %14
ret void
}

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