#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*/ glRasterPos3f(float, float, float);
int /*<<< orphan*/ glutBitmapCharacter(void *, int);
void drawString(void *font, float x, float y, float z, char *str) {
  char *ch = NULL;
  glRasterPos3f(x, y, z);
  for (ch = str; *ch; ch++)
    glutBitmapCharacter(font, (int)*ch);
}


x86 assembly (clang, -O0):
<drawString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <glRasterPos3f@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     1191 <drawString+0x71>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
movsbl (%rax),%esi
call   1040 <glutBitmapCharacter@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1163 <drawString+0x43>
add    $0x30,%rsp
pop    %rbp
ret

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

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

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