#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(double, double, double, double, double, double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void skaliraj(int w, int h) {
  double xmin = -10.0, xmax = 10.0;
  double xrange = xmax - xmin;
  double yrange = h * xrange / w;
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(xmin, xmax, -yrange / 2.0, yrange / 2.0, xmin, xmax);
}


x86 assembly (clang, -O0):
<skaliraj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  0xeba(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  0xe1f(%rip),%xmm3
divsd  %xmm3,%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  0xe0e(%rip),%xmm4
divsd  %xmm4,%xmm3
movsd  -0x10(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
call   1040 <glOrtho@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skaliraj>:
push   %rax
mov    %esi,%ecx
cvtsi2sd %esi,%xmm1
mulsd  0xeb1(%rip),%xmm1
mov    %edi,%edx
cvtsi2sd %edi,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
call   1060 <glViewport@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
movsd  0xe84(%rip),%xmm2
movsd  (%rsp),%xmm3
mulsd  %xmm3,%xmm2
mulsd  0xe7b(%rip),%xmm3
movsd  0xe7b(%rip),%xmm0
movsd  0xe7b(%rip),%xmm1
movaps %xmm0,%xmm4
movaps %xmm1,%xmm5
pop    %rax
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 double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
store double -1.000000e+01, double* %5
store double 1.000000e+01, double* %6
%9 = load double, double* %6
%10 = load double, double* %5
%11 = fsub double %9, %10
store double %11, double* %7
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = load double, double* %7
%15 = fmul double %13, %14
%16 = load i32, i32* %3
%17 = sitofp i32 %16 to double
%18 = fdiv double %15, %17
store double %18, double* %8
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @glViewport(i32 0, i32 0, i32 %19, i32 %20)
%22 = load i32, i32* @GL_PROJECTION
%23 = call i32 @glMatrixMode(i32 %22)
%24 = call i32 (...) @glLoadIdentity()
%25 = load double, double* %5
%26 = load double, double* %6
%27 = load double, double* %8
%28 = fneg double %27
%29 = fdiv double %28, 2.000000e+00
%30 = load double, double* %8
%31 = fdiv double %30, 2.000000e+00
%32 = load double, double* %5
%33 = load double, double* %6
%34 = call i32 @glOrtho(double %25, double %26, double %29, double %31, double %32, double %33)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @skaliraj(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 2.000000e+01
%5 = sitofp i32 %0 to double
%6 = fdiv double %4, %5
%7 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%8 = load i32, i32* @GL_PROJECTION
%9 = tail call i32 @glMatrixMode(i32 %8)
%10 = tail call i32 (...) @glLoadIdentity()
%11 = fmul double %6, -5.000000e-01
%12 = fmul double %6, 5.000000e-01
%13 = tail call i32 @glOrtho(double -1.000000e+01, double 1.000000e+01, double %11, double %12, double -1.000000e+01, double 1.000000e+01)
ret void
}