#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*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gluPerspective(float, float, float, float);
void changeSize(int w, int h) {
  if (h == 0)
    h = 1;
  float ratio = w * 1.0 / h;
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glViewport(0, 0, w, h);
  gluPerspective(45.0f, ratio, 0.1f, 100.0f);
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<changeSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115f <changeSize+0x1f>
movl   $0x1,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
movss  -0xc(%rbp),%xmm1
movss  0xe4d(%rip),%xmm0
movss  0xe49(%rip),%xmm2
movss  0xe45(%rip),%xmm3
call   1040 <gluPerspective@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeSize>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   %esi,%esi
mov    $0x1,%ebp
cmovne %esi,%ebp
cvtsi2sd %edi,%xmm0
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1060 <glViewport@plt>
movss  0xe71(%rip),%xmm0
movss  0xe6d(%rip),%xmm2
movss  0xe69(%rip),%xmm3
movss  0x4(%rsp),%xmm1
call   1040 <gluPerspective@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <glMatrixMode@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @changeSize(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %4
br label %9
9: ; preds = %8, %2
%10 = load i32, i32* %3
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 1.000000e+00
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
%16 = fptrunc double %15 to float
store float %16, float* %5
%17 = load i32, i32* @GL_PROJECTION
%18 = call i32 @glMatrixMode(i32 %17)
%19 = call i32 (...) @glLoadIdentity()
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 @glViewport(i32 0, i32 0, i32 %20, i32 %21)
%23 = load float, float* %5
%24 = call i32 @gluPerspective(float 4.500000e+01, float %23, float 0x3FB99999A0000000, float 1.000000e+02)
%25 = load i32, i32* @GL_MODELVIEW
%26 = call i32 @glMatrixMode(i32 %25)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @changeSize(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 1, i32 %1
%5 = sitofp i32 %0 to double
%6 = sitofp i32 %4 to double
%7 = fdiv double %5, %6
%8 = fptrunc double %7 to float
%9 = load i32, i32* @GL_PROJECTION
%10 = tail call i32 @glMatrixMode(i32 %9)
%11 = tail call i32 (...) @glLoadIdentity()
%12 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %4)
%13 = tail call i32 @gluPerspective(float 4.500000e+01, float %8, float 0x3FB99999A0000000, float 1.000000e+02)
%14 = load i32, i32* @GL_MODELVIEW
%15 = tail call i32 @glMatrixMode(i32 %14)
ret void
}