#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_HELVETICA_18;
int /*<<< orphan*/ glColor3f(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glRasterPos3f(float, float, float);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void drawstring(float x, float y, float z, char *string) {
  char *c;
  glRasterPos3f(x, y, z);
  for (c = string; *c != '\0'; c++) {
    glColor3f(0, 0, 0);
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, *c);
  }
}


x86 assembly (clang, -O0):
<drawstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <glRasterPos3f@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a8 <drawstring+0x78>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <glColor3f@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
movsbl (%rax),%esi
call   1040 <glutBitmapCharacter@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1167 <drawstring+0x37>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawstring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <glRasterPos3f@plt>
cmpb   $0x0,(%rbx)
je     1170 <drawstring+0x40>
add    $0x1,%rbx
mov    0x2e94(%rip),%r14
nopl   0x0(%rax)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <glColor3f@plt>
mov    (%r14),%edi
movsbl -0x1(%rbx),%esi
call   1040 <glutBitmapCharacter@plt>
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <drawstring+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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