#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*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ GLUT_BITMAP_9_BY_15;
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glRasterPos2i(int, int);
scalar_t__ gluErrorString(int /*<<< orphan*/);
int /*<<< orphan*/ glutBitmapCharacter(int /*<<< orphan*/, char const);
scalar_t__ strlen(char const *);
void my_error(GLenum err) {
  int len, i;
  const char *str;
  glColor3f(0.9, 0.9, 0.9);
  glRasterPos2i(5, 5);
  str = (char *)gluErrorString(err);
  len = (int)strlen(str);
  for (i = 0; i < len; i++)
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, str[i]);
}


x86 assembly (clang, -O0):
<my_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  0xe9d(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
mov    $0x5,%esi
mov    %esi,%edi
call   1070 <glRasterPos2i@plt>
mov    -0x4(%rbp),%edi
call   1060 <gluErrorString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cd <my_error+0x7d>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1199 <my_error+0x49>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_error>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
movsd  0xe9e(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1050 <glColor3f@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1070 <glRasterPos2i@plt>
mov    %ebx,%edi
call   1060 <gluErrorString@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11b7 <my_error+0x67>
mov    %eax,%r15d
xor    %ebx,%ebx
mov    0x2e4a(%rip),%r12
xchg   %ax,%ax
mov    (%r12),%edi
movsbl (%r14,%rbx,1),%esi
call   1030 <glutBitmapCharacter@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11a0 <my_error+0x50>
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 @my_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %2
%6 = call i32 @glColor3f(double 9.000000e-01, double 9.000000e-01, double 9.000000e-01)
%7 = call i32 @glRasterPos2i(i32 5, i32 5)
%8 = load i32, i32* %2
%9 = call i64 @gluErrorString(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
store i32 0, i32* %4
br label %14
14: ; preds = %26, %1
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32, i32* @GLUT_BITMAP_9_BY_15
%20 = load i8*, i8** %5
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @glutBitmapCharacter(i32 %19, i8 signext %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %14
29: ; preds = %14
ret void
}

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