#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*/ glOrtho(int /*<<< orphan*/, int, float, float, double,
                           double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void skaliraj(int w, int h) {
  float a = 1000 - 0, b;
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  b = a * (float)h / (float)w;
  glOrtho(0, 1000, -b / 2.0, b / 2.0, -1.0, 1.0);
}


x86 assembly (clang, -O0):
<skaliraj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  0xec2(%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   1050 <glLoadIdentity@plt>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe57(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe3e(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
xor    %edi,%edi
mov    $0x3e8,%esi
movsd  0xe17(%rip),%xmm2
movsd  0xe17(%rip),%xmm3
call   1040 <glOrtho@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   1050 <glLoadIdentity@plt>
cvtsi2ss %ebx,%xmm1
mulss  0xe8b(%rip),%xmm1
cvtsi2ss %ebp,%xmm0
divss  %xmm0,%xmm1
movss  0xe7f(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  0xe77(%rip),%xmm1
movsd  0xe77(%rip),%xmm2
movsd  0xe77(%rip),%xmm3
xor    %edi,%edi
mov    $0x3e8,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <glOrtho@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 1.000000e+03, 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 float, float* %5
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fmul float %13, %15
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to float
%19 = fdiv float %16, %18
store float %19, float* %6
%20 = load float, float* %6
%21 = fneg float %20
%22 = fpext float %21 to double
%23 = fdiv double %22, 2.000000e+00
%24 = fptrunc double %23 to float
%25 = load float, float* %6
%26 = fpext float %25 to double
%27 = fdiv double %26, 2.000000e+00
%28 = fptrunc double %27 to float
%29 = call i32 @glOrtho(i32 0, i32 1000, float %24, float %28, double -1.000000e+00, double 1.000000e+00)
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 = sitofp i32 %1 to float
%8 = fmul float %7, 1.000000e+03
%9 = sitofp i32 %0 to float
%10 = fdiv float %8, %9
%11 = fmul float %10, -5.000000e-01
%12 = fmul float %10, 5.000000e-01
%13 = tail call i32 @glOrtho(i32 0, i32 1000, float %11, float %12, double -1.000000e+00, double 1.000000e+00)
ret void
}