#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_8_BY_13;
int /*<<< orphan*/ glRasterPos2i(int, int);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char);
void emitString(char *s, int tx, int ty) {
  int x, y;
  x = tx;
  y = ty;
  while (*s) {
    if (*s == 13) {
      x = tx;
      y += 13 + 2;
    } else {
      glRasterPos2i(x, y);
      glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *s);
      x += 8;
    }
    ++s;
  }
}


x86 assembly (clang, -O0):
<emitString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a9 <emitString+0x89>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    116f <emitString+0x4f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <emitString+0x78>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <glRasterPos2i@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113e <emitString+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitString>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbp
mov    0x2ea8(%rip),%r12
mov    %esi,%ebx
jmp    114b <emitString+0x2b>
nopl   0x0(%rax)
add    $0xf,%r15d
add    $0x1,%rbp
mov    %r14d,%ebx
movzbl 0x0(%rbp),%eax
cmp    $0xd,%al
je     1140 <emitString+0x20>
test   %al,%al
je     1177 <emitString+0x57>
mov    %ebx,%edi
mov    %r15d,%esi
call   1040 <glRasterPos2i@plt>
mov    (%r12),%edi
movsbl 0x0(%rbp),%esi
call   1030 <glutBitmapCharacter@plt>
add    $0x8,%ebx
add    $0x1,%rbp
jmp    114b <emitString+0x2b>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@GLUT_BITMAP_8_BY_13 = global i32 0
define void @emitString(i8* nocapture %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %17, %3
%5 = phi i8* [ %0, %3 ], [ %20, %17 ]
%6 = phi i32 [ %1, %3 ], [ %18, %17 ]
%7 = phi i32 [ %2, %3 ], [ %19, %17 ]
%8 = load i8, i8* %5
switch i8 %8, label %11 [
i8 0, label %21
i8 13, label %9
]
9: ; preds = %4
%10 = add nsw i32 %7, 15
br label %17
11: ; preds = %4
%12 = tail call i32 @glRasterPos2i(i32 %6, i32 %7)
%13 = load i32, i32* @GLUT_BITMAP_8_BY_13
%14 = load i8, i8* %5
%15 = tail call i32 @glutBitmapCharacter(i32 %13, i8 signext %14)
%16 = add nsw i32 %6, 8
br label %17
17: ; preds = %11, %9
%18 = phi i32 [ %1, %9 ], [ %16, %11 ]
%19 = phi i32 [ %10, %9 ], [ %7, %11 ]
%20 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
21: ; preds = %4
ret void
}