#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_STROKE_MONO_ROMAN;
int /*<<< orphan*/ glLineWidth(double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glScalef(double, double, double);
int /*<<< orphan*/ glTranslatef(float, float, int /*<<< orphan*/);
int /*<<< orphan*/ glutStrokeCharacter(int /*<<< orphan*/, char);
void draw_string(float x, float y, char *str) {
  glPushMatrix();
  glLoadIdentity();
  glLineWidth(2.0);
  glTranslatef(x, -y, 0);
  glScalef(0.04, 0.04, 0.04);
  for (; *str != '\0'; str++)
    glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, *str);
  glPopMatrix();
}


x86 assembly (clang, -O0):
<draw_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <glPushMatrix@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
movsd  0xe6c(%rip),%xmm0
call   1030 <glLineWidth@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
xor    %edi,%edi
call   1090 <glTranslatef@plt>
movsd  0xe39(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1070 <glScalef@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1208 <draw_string+0x98>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1040 <glutStrokeCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11d2 <draw_string+0x62>
mov    $0x0,%al
call   1050 <glPopMatrix@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_string>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
movaps %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1080 <glPushMatrix@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
movsd  0xe65(%rip),%xmm0
call   1030 <glLineWidth@plt>
movaps 0x10(%rsp),%xmm1
xorps  0xe64(%rip),%xmm1
movss  0xc(%rsp),%xmm0
xor    %edi,%edi
call   1090 <glTranslatef@plt>
movsd  0xe47(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1070 <glScalef@plt>
mov    (%rbx),%al
test   %al,%al
je     11f6 <draw_string+0x86>
add    $0x1,%rbx
mov    0x2e0b(%rip),%r14
nopl   (%rax)
mov    (%r14),%edi
movsbl %al,%esi
call   1040 <glutStrokeCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11e0 <draw_string+0x70>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1050 <glPopMatrix@plt>

LLVM IR (-O0):
@GLUT_STROKE_MONO_ROMAN = global i32 0
define void @draw_string(float %0, float %1, i8* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i8*
store float %0, float* %4
store float %1, float* %5
store i8* %2, i8** %6
%7 = call i32 (...) @glPushMatrix()
%8 = call i32 (...) @glLoadIdentity()
%9 = call i32 @glLineWidth(double 2.000000e+00)
%10 = load float, float* %4
%11 = load float, float* %5
%12 = fneg float %11
%13 = call i32 @glTranslatef(float %10, float %12, i32 0)
%14 = call i32 @glScalef(double 4.000000e-02, double 4.000000e-02, double 4.000000e-02)
br label %15
15: ; preds = %25, %3
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %15
%21 = load i32, i32* @GLUT_STROKE_MONO_ROMAN
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = call i32 @glutStrokeCharacter(i32 %21, i8 signext %23)
br label %25
25: ; preds = %20
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %6
br label %15
28: ; preds = %15
%29 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
@GLUT_STROKE_MONO_ROMAN = global i32 0
define void @draw_string(float %0, float %1, i8* nocapture %2) {
%4 = tail call i32 (...) @glPushMatrix()
%5 = tail call i32 (...) @glLoadIdentity()
%6 = tail call i32 @glLineWidth(double 2.000000e+00)
%7 = fneg float %1
%8 = tail call i32 @glTranslatef(float %0, float %7, i32 0)
%9 = tail call i32 @glScalef(double 4.000000e-02, double 4.000000e-02, double 4.000000e-02)
%10 = load i8, i8* %2
%11 = icmp eq i8 %10, 0
br i1 %11, label %20, label %12
12: ; preds = %3, %12
%13 = phi i8 [ %18, %12 ], [ %10, %3 ]
%14 = phi i8* [ %17, %12 ], [ %2, %3 ]
%15 = load i32, i32* @GLUT_STROKE_MONO_ROMAN
%16 = tail call i32 @glutStrokeCharacter(i32 %15, i8 signext %13)
%17 = getelementptr inbounds i8, i8* %14, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %3
%21 = tail call i32 (...) @glPopMatrix()
ret void
}