#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_10;
int /*<<< orphan*/ glRasterPos2f(float, float);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void draw_text(float x, float y, char *string) {
  char *c;
  glRasterPos2f(x, y);
  for (c = string; *c != '\0'; c++) {
    glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *c);
  }
}


x86 assembly (clang, -O0):
<draw_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <glRasterPos2f@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1183 <draw_text+0x63>
mov    0x2e84(%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    114d <draw_text+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_text>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <glRasterPos2f@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <draw_text+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 <draw_text+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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