#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_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gluOrtho2D(float, float, float, float);
void skaliraj(int w, int h) {
  float a = 0.5f, b;
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w > h) {
    b = a * (float)w / (float)h;
    gluOrtho2D(0.0f, 2.0f * b, -a, a);
  } else {
    b = a * (float)h / (float)w;
    gluOrtho2D(0.0f, 2.0f * a, -b, b);
  }
}


x86 assembly (clang, -O0):
<skaliraj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  0xeaa(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11d8 <skaliraj+0x98>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe55(%rip),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0xc(%rbp),%xmm3
xorps  %xmm0,%xmm0
call   1050 <gluOrtho2D@plt>
jmp    1220 <skaliraj+0xe0>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe08(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0x10(%rbp),%xmm3
xorps  %xmm0,%xmm0
call   1050 <gluOrtho2D@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skaliraj>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1060 <glViewport@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
cmp    %ebx,%ebp
jle    1193 <skaliraj+0x53>
cvtsi2ss %ebp,%xmm1
movss  0xe87(%rip),%xmm3
mulss  %xmm3,%xmm1
cvtsi2ss %ebx,%xmm0
divss  %xmm0,%xmm1
addss  %xmm1,%xmm1
movss  0xe77(%rip),%xmm2
jmp    11b9 <skaliraj+0x79>
cvtsi2ss %ebx,%xmm3
mulss  0xe61(%rip),%xmm3
cvtsi2ss %ebp,%xmm0
divss  %xmm0,%xmm3
movaps 0xe62(%rip),%xmm2
xorps  %xmm3,%xmm2
movss  0xe4b(%rip),%xmm1
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <gluOrtho2D@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @skaliraj(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
store float 5.000000e-01, float* %5
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @glViewport(i32 0, i32 0, i32 %7, i32 %8)
%10 = load i32, i32* @GL_PROJECTION
%11 = call i32 @glMatrixMode(i32 %10)
%12 = call i32 (...) @glLoadIdentity()
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %30
16: ; preds = %2
%17 = load float, float* %5
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = fmul float %17, %19
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to float
%23 = fdiv float %20, %22
store float %23, float* %6
%24 = load float, float* %6
%25 = fmul float 2.000000e+00, %24
%26 = load float, float* %5
%27 = fneg float %26
%28 = load float, float* %5
%29 = call i32 @gluOrtho2D(float 0.000000e+00, float %25, float %27, float %28)
br label %44
30: ; preds = %2
%31 = load float, float* %5
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to float
%34 = fmul float %31, %33
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to float
%37 = fdiv float %34, %36
store float %37, float* %6
%38 = load float, float* %5
%39 = fmul float 2.000000e+00, %38
%40 = load float, float* %6
%41 = fneg float %40
%42 = load float, float* %6
%43 = call i32 @gluOrtho2D(float 0.000000e+00, float %39, float %41, float %42)
br label %44
44: ; preds = %30, %16
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @skaliraj(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%4 = load i32, i32* @GL_PROJECTION
%5 = tail call i32 @glMatrixMode(i32 %4)
%6 = tail call i32 (...) @glLoadIdentity()
%7 = icmp sgt i32 %0, %1
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = sitofp i32 %0 to float
%10 = fmul float %9, 5.000000e-01
%11 = sitofp i32 %1 to float
%12 = fdiv float %10, %11
%13 = fmul float %12, 2.000000e+00
%14 = tail call i32 @gluOrtho2D(float 0.000000e+00, float %13, float -5.000000e-01, float 5.000000e-01)
br label %22
15: ; preds = %2
%16 = sitofp i32 %1 to float
%17 = fmul float %16, 5.000000e-01
%18 = sitofp i32 %0 to float
%19 = fdiv float %17, %18
%20 = fneg float %19
%21 = tail call i32 @gluOrtho2D(float 0.000000e+00, float 1.000000e+00, float %20, float %19)
br label %22
22: ; preds = %15, %8
ret void
}