#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 double GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_COMPILE;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_DIFFUSE;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_POSITION;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ glLightfv(int /*<<< orphan*/, int /*<<< orphan*/, double *);
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glNewList(int, int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gluLookAt(double, double, double, double, double, double,
                             double, double, int);
int /*<<< orphan*/ gluPerspective(double, int, double, double);
int /*<<< orphan*/ glutSolidTorus(double, double, int, int);
int /*<<< orphan*/ glutWireTorus(double, double, int, int);
int /*<<< orphan*/ strcmp(char *, char *);
void testInit(int argc, char **argv, int width, int height) {
  static GLfloat light_diffuse[] = {1.0, 0.0, 0.0, 1.0};
  static GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0};
  int solid, i;
  glViewport(0, 0, width, height);
  glMatrixMode(GL_PROJECTION);
  gluPerspective(25.0, width / height, 1.0, 10.0);
  glMatrixMode(GL_MODELVIEW);
  gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.);
  glTranslatef(0.0, 0.0, -1.0);
  glColor3f(1.0, 0.0, 0.0);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  solid = 1;
  for (i = 1; i < argc; i++) {
    if (!strcmp("-light", argv[i])) {
      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
    } else if (!strcmp("-depth", argv[i])) {
      glEnable(GL_DEPTH_TEST);
    } else if (!strcmp("-wire", argv[i])) {
      solid = 0;
    }
  }
  glNewList(1, GL_COMPILE);
  if (solid) {
    glutSolidTorus(0.25, 0.75, 100, 100);
  } else {
    glutWireTorus(0.25, 0.75, 100, 100);
  }
  glEndList();
}


x86 assembly (clang, -O0):
<testInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   10d0 <glViewport@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,%edi
movsd  0xe05(%rip),%xmm0
movsd  0xde5(%rip),%xmm1
movsd  0xdfd(%rip),%xmm2
call   1080 <gluPerspective@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xorps  %xmm6,%xmm6
movsd  0xdcf(%rip),%xmm2
movsd  0xdb7(%rip),%xmm7
xor    %edi,%edi
movaps %xmm6,%xmm0
movaps %xmm6,%xmm1
movaps %xmm6,%xmm3
movaps %xmm6,%xmm4
movaps %xmm6,%xmm5
call   1040 <gluLookAt@plt>
xorps  %xmm1,%xmm1
movsd  0xd9e(%rip),%xmm2
movaps %xmm1,%xmm0
call   10b0 <glTranslatef@plt>
movsd  0xd86(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   10a0 <glColor3f@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    0x2d23(%rip),%rax
mov    (%rax),%esi
lea    0x2df2(%rip),%rdx
call   1030 <glLightfv@plt>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
mov    0x2d1d(%rip),%rax
mov    (%rax),%esi
lea    0x2df4(%rip),%rdx
call   1030 <glLightfv@plt>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1396 <testInit+0x1c6>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd4a(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    131d <testInit+0x14d>
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
jmp    1383 <testInit+0x1b3>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd0f(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1351 <testInit+0x181>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
jmp    137e <testInit+0x1ae>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xce2(%rip),%rdi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1379 <testInit+0x1a9>
movl   $0x0,-0x1c(%rbp)
jmp    137e <testInit+0x1ae>
jmp    1383 <testInit+0x1b3>
jmp    1388 <testInit+0x1b8>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12cf <testInit+0xff>
mov    0x2c13(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1070 <glNewList@plt>
cmpl   $0x0,-0x1c(%rbp)
je     13d4 <testInit+0x204>
movsd  0xc6d(%rip),%xmm0
movsd  0xc6d(%rip),%xmm1
mov    $0x64,%esi
mov    %esi,%edi
call   10f0 <glutSolidTorus@plt>
jmp    13f0 <testInit+0x220>
movsd  0xc4c(%rip),%xmm0
movsd  0xc4c(%rip),%xmm1
mov    $0x64,%esi
mov    %esi,%edi
call   10c0 <glutWireTorus@plt>
mov    $0x0,%al
call   10e0 <glEndList@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testInit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
xor    %edi,%edi
xor    %esi,%esi
call   10d0 <glViewport@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    %ebp,%eax
cltd
idiv   %r15d
movsd  0xdf5(%rip),%xmm0
movsd  0xdf5(%rip),%xmm1
movsd  0xdf5(%rip),%xmm2
mov    %eax,%edi
call   1080 <gluPerspective@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
movsd  0xde0(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
xorps  %xmm4,%xmm4
xorps  %xmm5,%xmm5
xorps  %xmm6,%xmm6
movsd  0xdb6(%rip),%xmm7
xor    %edi,%edi
call   1040 <gluLookAt@plt>
movsd  0xdbf(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   10b0 <glTranslatef@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  0xd8e(%rip),%xmm0
call   10a0 <glColor3f@plt>
mov    0x2d62(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
lea    0x2df7(%rip),%rdx
call   1030 <glLightfv@plt>
mov    0x0(%rbp),%edi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
lea    0x2dff(%rip),%rdx
call   1030 <glLightfv@plt>
cmp    $0x1,%r14d
jle    1359 <testInit+0x189>
mov    %r14d,%r15d
mov    $0x1,%r13d
mov    $0x1,%r14d
lea    0xd62(%rip),%r12
jmp    1305 <testInit+0x135>
nopl   0x0(%rax,%rax,1)
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
add    $0x1,%r14
cmp    %r14,%r15
je     136e <testInit+0x19e>
mov    (%rbx,%r14,8),%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     12e0 <testInit+0x110>
lea    0xd20(%rip),%rdi
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1350 <testInit+0x180>
lea    0xd14(%rip),%rdi
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
cmove  %eax,%r13d
jmp    12fc <testInit+0x12c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2c51(%rip),%rax
jmp    12f5 <testInit+0x125>
mov    0x2c50(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1070 <glNewList@plt>
jmp    1386 <testInit+0x1b6>
mov    0x2c3b(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
call   1070 <glNewList@plt>
test   %r13d,%r13d
je     13a7 <testInit+0x1d7>
movsd  0xc9a(%rip),%xmm0
movsd  0xc9a(%rip),%xmm1
mov    $0x64,%edi
mov    $0x64,%esi
call   10f0 <glutSolidTorus@plt>
jmp    13c6 <testInit+0x1f6>
movsd  0xc79(%rip),%xmm0
movsd  0xc79(%rip),%xmm1
mov    $0x64,%edi
mov    $0x64,%esi
call   10c0 <glutWireTorus@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10e0 <glEndList@plt>

LLVM IR (-O0):
@testInit.light_diffuse = internal global [4 x double] [double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00]
@testInit.light_position = internal global [4 x double] [double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 0.000000e+00]
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_LIGHT0 = global i32 0
@GL_DIFFUSE = global i32 0
@GL_POSITION = global i32 0
@.str = [7 x i8] c"-light\00"
@GL_LIGHTING = global i32 0
@.str.1 = [7 x i8] c"-depth\00"
@GL_DEPTH_TEST = global i32 0
@.str.2 = [6 x i8] c"-wire\00"
@GL_COMPILE = global i32 0
define void @testInit(i32 %0, i8** %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @glViewport(i32 0, i32 0, i32 %11, i32 %12)
%14 = load i32, i32* @GL_PROJECTION
%15 = call i32 @glMatrixMode(i32 %14)
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = sdiv i32 %16, %17
%19 = call i32 @gluPerspective(double 2.500000e+01, i32 %18, double 1.000000e+00, double 1.000000e+01)
%20 = load i32, i32* @GL_MODELVIEW
%21 = call i32 @glMatrixMode(i32 %20)
%22 = call i32 @gluLookAt(double 0.000000e+00, double 0.000000e+00, double 5.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00, i32 0)
%23 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%24 = call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%25 = load i32, i32* @GL_LIGHT0
%26 = load i32, i32* @GL_DIFFUSE
%27 = call i32 @glLightfv(i32 %25, i32 %26, double* getelementptr inbounds ([4 x double], [4 x double]* @testInit.light_diffuse, i64 0, i64 0))
%28 = load i32, i32* @GL_LIGHT0
%29 = load i32, i32* @GL_POSITION
%30 = call i32 @glLightfv(i32 %28, i32 %29, double* getelementptr inbounds ([4 x double], [4 x double]* @testInit.light_position, i64 0, i64 0))
store i32 1, i32* %9
store i32 1, i32* %10
br label %31
31: ; preds = %71, %4
%32 = load i32, i32* %10
%33 = load i32, i32* %5
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %74
35: ; preds = %31
%36 = load i8**, i8*** %6
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %35
%44 = load i32, i32* @GL_LIGHTING
%45 = call i32 @glEnable(i32 %44)
%46 = load i32, i32* @GL_LIGHT0
%47 = call i32 @glEnable(i32 %46)
br label %70
48: ; preds = %35
%49 = load i8**, i8*** %6
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %48
%57 = load i32, i32* @GL_DEPTH_TEST
%58 = call i32 @glEnable(i32 %57)
br label %69
59: ; preds = %48
%60 = load i8**, i8*** %6
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %64)
%66 = icmp ne i32 %65, 0
br i1 %66, label %68, label %67
67: ; preds = %59
store i32 0, i32* %9
br label %68
68: ; preds = %67, %59
br label %69
69: ; preds = %68, %56
br label %70
70: ; preds = %69, %43
br label %71
71: ; preds = %70
%72 = load i32, i32* %10
%73 = add nsw i32 %72, 1
store i32 %73, i32* %10
br label %31
74: ; preds = %31
%75 = load i32, i32* @GL_COMPILE
%76 = call i32 @glNewList(i32 1, i32 %75)
%77 = load i32, i32* %9
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @glutSolidTorus(double 2.500000e-01, double 7.500000e-01, i32 100, i32 100)
br label %83
81: ; preds = %74
%82 = call i32 @glutWireTorus(double 2.500000e-01, double 7.500000e-01, i32 100, i32 100)
br label %83
83: ; preds = %81, %79
%84 = call i32 (...) @glEndList()
ret void
}

LLVM IR (-O2):
@testInit.light_diffuse = internal global [4 x double] [double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00]
@testInit.light_position = internal global [4 x double] [double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 0.000000e+00]
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_LIGHT0 = global i32 0
@GL_DIFFUSE = global i32 0
@GL_POSITION = global i32 0
@.str = [7 x i8] c"-light\00"
@GL_LIGHTING = global i32 0
@.str.1 = [7 x i8] c"-depth\00"
@GL_DEPTH_TEST = global i32 0
@.str.2 = [6 x i8] c"-wire\00"
@GL_COMPILE = global i32 0
define void @testInit(i32 %0, i8** nocapture %1, i32 %2, i32 %3) {
%5 = tail call i32 @glViewport(i32 0, i32 0, i32 %2, i32 %3)
%6 = load i32, i32* @GL_PROJECTION
%7 = tail call i32 @glMatrixMode(i32 %6)
%8 = sdiv i32 %2, %3
%9 = tail call i32 @gluPerspective(double 2.500000e+01, i32 %8, double 1.000000e+00, double 1.000000e+01)
%10 = load i32, i32* @GL_MODELVIEW
%11 = tail call i32 @glMatrixMode(i32 %10)
%12 = tail call i32 @gluLookAt(double 0.000000e+00, double 0.000000e+00, double 5.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00, i32 0)
%13 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%14 = tail call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%15 = load i32, i32* @GL_LIGHT0
%16 = load i32, i32* @GL_DIFFUSE
%17 = tail call i32 @glLightfv(i32 %15, i32 %16, double* getelementptr inbounds ([4 x double], [4 x double]* @testInit.light_diffuse, i64 0, i64 0))
%18 = load i32, i32* @GL_LIGHT0
%19 = load i32, i32* @GL_POSITION
%20 = tail call i32 @glLightfv(i32 %18, i32 %19, double* getelementptr inbounds ([4 x double], [4 x double]* @testInit.light_position, i64 0, i64 0))
%21 = icmp sgt i32 %0, 1
br i1 %21, label %25, label %22
22: ; preds = %4
%23 = load i32, i32* @GL_COMPILE
%24 = tail call i32 @glNewList(i32 1, i32 %23)
br label %57
25: ; preds = %4
%26 = zext i32 %0 to i64
br label %27
27: ; preds = %25, %49
%28 = phi i64 [ 1, %25 ], [ %51, %49 ]
%29 = phi i32 [ 1, %25 ], [ %50, %49 ]
%30 = getelementptr inbounds i8*, i8** %1, i64 %28
%31 = load i8*, i8** %30
%32 = tail call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %27
%35 = load i32, i32* @GL_LIGHTING
%36 = tail call i32 @glEnable(i32 %35)
%37 = load i32, i32* @GL_LIGHT0
%38 = tail call i32 @glEnable(i32 %37)
br label %49
39: ; preds = %27
%40 = tail call i32 @strcmp(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %31)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* @GL_DEPTH_TEST
%44 = tail call i32 @glEnable(i32 %43)
br label %49
45: ; preds = %39
%46 = tail call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* dereferenceable(1) %31)
%47 = icmp eq i32 %46, 0
%48 = select i1 %47, i32 0, i32 %29
br label %49
49: ; preds = %45, %34, %42
%50 = phi i32 [ %29, %42 ], [ %29, %34 ], [ %48, %45 ]
%51 = add nuw nsw i64 %28, 1
%52 = icmp eq i64 %51, %26
br i1 %52, label %53, label %27
53: ; preds = %49
%54 = load i32, i32* @GL_COMPILE
%55 = tail call i32 @glNewList(i32 1, i32 %54)
%56 = icmp eq i32 %50, 0
br i1 %56, label %59, label %57
57: ; preds = %22, %53
%58 = tail call i32 @glutSolidTorus(double 2.500000e-01, double 7.500000e-01, i32 100, i32 100)
br label %61
59: ; preds = %53
%60 = tail call i32 @glutWireTorus(double 2.500000e-01, double 7.500000e-01, i32 100, i32 100)
br label %61
61: ; preds = %59, %57
%62 = tail call i32 (...) @glEndList()
ret void
}