#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 */
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ GLUT_BITMAP_HELVETICA_12;
int /*<<< orphan*/ glRasterPos2d(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void glWrite(GLdouble x, GLdouble y, const char *str) {
  glRasterPos2d(x, y);
  for (char *s = (char *)str; *s; s++)
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *s);
}


x86 assembly (clang, -O0):
<glWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glRasterPos2d@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1178 <glWrite+0x58>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1145 <glWrite+0x25>
add    $0x20,%rsp
pop    %rbp
ret

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

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

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