#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_9_BY_15;
int /*<<< orphan*/ glRasterPos2f(float, float);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
scalar_t__ strlen(char *);
void drawString(float x, float y, char *textString) {
  int textLength = (int)strlen(textString);
  for (int count = 0; count < textLength; count++) {
    float glX = (x + 9 * count);
    float glY = y;
    glRasterPos2f(glX, glY);
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, textString[count]);
  }
}


x86 assembly (clang, -O0):
<drawString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bc <drawString+0x8c>
movss  -0x4(%rbp),%xmm0
imul   $0x9,-0x18(%rbp),%eax
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
call   1050 <glRasterPos2f@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <drawString+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
call   1040 <strlen@plt>
test   %eax,%eax
jle    1191 <drawString+0x61>
mov    %eax,%eax
lea    (%rax,%rax,8),%r14
xor    %ebx,%ebx
mov    0x2e8a(%rip),%r12
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <glRasterPos2f@plt>
mov    (%r12),%edi
movsbl (%r15),%esi
call   1030 <glutBitmapCharacter@plt>
add    $0x9,%rbx
add    $0x1,%r15
cmp    %rbx,%r14
jne    1160 <drawString+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@GLUT_BITMAP_9_BY_15 = global i32 0
define void @drawString(float %0, float %1, i8* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
store float %0, float* %4
store float %1, float* %5
store i8* %2, i8** %6
%11 = load i8*, i8** %6
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %7
store i32 0, i32* %8
br label %14
14: ; preds = %35, %3
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = load float, float* %4
%20 = load i32, i32* %8
%21 = mul nsw i32 9, %20
%22 = sitofp i32 %21 to float
%23 = fadd float %19, %22
store float %23, float* %9
%24 = load float, float* %5
store float %24, float* %10
%25 = load float, float* %9
%26 = load float, float* %10
%27 = call i32 @glRasterPos2f(float %25, float %26)
%28 = load i32, i32* @GLUT_BITMAP_9_BY_15
%29 = load i8*, i8** %6
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = call i32 @glutBitmapCharacter(i32 %28, i8 signext %33)
br label %35
35: ; preds = %18
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %14
38: ; preds = %14
ret void
}

LLVM IR (-O2):
@GLUT_BITMAP_9_BY_15 = global i32 0
define void @drawString(float %0, float %1, i8* nocapture %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%5 = trunc i64 %4 to i32
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = and i64 %4, 4294967295
br label %10
9: ; preds = %10, %3
ret void
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %21, %10 ]
%12 = trunc i64 %11 to i32
%13 = mul i32 %12, 9
%14 = sitofp i32 %13 to float
%15 = fadd float %14, %0
%16 = tail call i32 @glRasterPos2f(float %15, float %1)
%17 = load i32, i32* @GLUT_BITMAP_9_BY_15
%18 = getelementptr inbounds i8, i8* %2, i64 %11
%19 = load i8, i8* %18
%20 = tail call i32 @glutBitmapCharacter(i32 %17, i8 signext %19)
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %9, label %10
}