#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_TIMES_ROMAN_24;
int /*<<< orphan*/ glColor3f(int, int, int);
int /*<<< orphan*/ glRasterPos2i(int, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, int);
int strlen(char *);
void drawText(char s[], int x, int y, int r, int g, int b) {
  int i;
  glColor3f(r, g, b);
  glRasterPos2i(x, y);
  for (i = 0; i < strlen(s); i++)
    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, (int)(s[i]));
}


x86 assembly (clang, -O0):
<drawText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <glColor3f@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <glRasterPos2i@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    11c1 <drawText+0x81>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117d <drawText+0x3d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawText>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %ecx,%edi
mov    %r8d,%esi
mov    %r9d,%edx
call   1050 <glColor3f@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1060 <glRasterPos2i@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    119f <drawText+0x5f>
xor    %ebp,%ebp
mov    0x2e68(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
movsbl (%rbx,%rbp,1),%esi
call   1030 <glutBitmapCharacter@plt>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1180 <drawText+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@GLUT_BITMAP_TIMES_ROMAN_24 = global i32 0
define void @drawText(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @glColor3f(i32 %3, i32 %4, i32 %5)
%8 = tail call i32 @glRasterPos2i(i32 %1, i32 %2)
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6, %11
%12 = phi i64 [ %18, %11 ], [ 0, %6 ]
%13 = load i32, i32* @GLUT_BITMAP_TIMES_ROMAN_24
%14 = getelementptr inbounds i8, i8* %0, i64 %12
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @glutBitmapCharacter(i32 %13, i32 %16)
%18 = add nuw nsw i64 %12, 1
%19 = tail call i32 @strlen(i8* %0)
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %11, label %22
22: ; preds = %11, %6
ret void
}