#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(int, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
scalar_t__ strlen(char *);
void DrawString(int x, int y, char *string) {
  int len, i;
  glRasterPos2f(x, y);
  len = (int)strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
  }
}


x86 assembly (clang, -O0):
<DrawString>:
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   1050 <glRasterPos2f@plt>
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    1194 <DrawString+0x64>
mov    0x2e75(%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    1160 <DrawString+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
call   1050 <glRasterPos2f@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1177 <DrawString+0x47>
mov    %eax,%r15d
xor    %ebx,%ebx
mov    0x2e90(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
movsbl (%r14,%rbx,1),%esi
call   1030 <glutBitmapCharacter@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
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(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @glRasterPos2f(i32 %9, i32 %10)
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = trunc i64 %13 to i32
store i32 %14, i32* %7
store i32 0, i32* %8
br label %15
15: ; preds = %27, %3
%16 = load i32, i32* %8
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32, i32* @GLUT_BITMAP_9_BY_15
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @glutBitmapCharacter(i32 %20, i8 signext %25)
br label %27
27: ; preds = %19
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %15
30: ; preds = %15
ret void
}

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