#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 */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GLUT_BITMAP_TIMES_ROMAN_10;
int /*<<< orphan*/ glColor4fv(int /*<<< orphan*/ *);
int /*<<< orphan*/ glRasterPos2f(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void drawString(char *string, GLfloat x, GLfloat y, GLfloat color[4]) {
  glColor4fv(color);
  glRasterPos2f(x, y);
  while (*string) {
    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, *string);
    string++;
  }
}


x86 assembly (clang, -O0):
<drawString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <glColor4fv@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <glRasterPos2f@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118d <drawString+0x5d>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    115a <drawString+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawString>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rcx,%rdi
call   1040 <glColor4fv@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1050 <glRasterPos2f@plt>
mov    (%rbx),%al
test   %al,%al
je     1176 <drawString+0x46>
add    $0x1,%rbx
mov    0x2e89(%rip),%rbp
nop
mov    0x0(%rbp),%edi
movsbl %al,%esi
call   1030 <glutBitmapCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <drawString+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@GLUT_BITMAP_TIMES_ROMAN_10 = global i32 0
define void @drawString(i8* nocapture %0, i32 %1, i32 %2, i32* %3) {
%5 = tail call i32 @glColor4fv(i32* %3)
%6 = tail call i32 @glRasterPos2f(i32 %1, i32 %2)
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %4, %9
%10 = phi i8 [ %15, %9 ], [ %7, %4 ]
%11 = phi i8* [ %14, %9 ], [ %0, %4 ]
%12 = load i32, i32* @GLUT_BITMAP_TIMES_ROMAN_10
%13 = tail call i32 @glutBitmapCharacter(i32 %12, i8 signext %10)
%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, %4
ret void
}