#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 scalar_t__ GLsizei;
typedef int /*<<< orphan*/ GLint;
typedef scalar_t__ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_POINT_SIZE_RANGE;
int /*<<< orphan*/ GL_VIEWPORT;
int /*<<< orphan*/ glGetFloatv(int /*<<< orphan*/, scalar_t__ *);
int /*<<< orphan*/ glGetIntegerv(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ glPointSize(scalar_t__);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              scalar_t__, scalar_t__);
void reshape(GLsizei width, GLsizei height) {
  static GLint viewport[4];
  GLfloat point_size_limits[2];
  GLfloat point_size;
  GLsizei new_size;
  new_size = (width < height) ? width : height;
  glGetFloatv(GL_POINT_SIZE_RANGE, &point_size_limits[0]);
  point_size = new_size / 25.f;
  if (point_size < point_size_limits[0])
    point_size = point_size_limits[0];
  if (point_size > point_size_limits[1])
    point_size = point_size_limits[1];
  glPointSize(point_size);
  glGetIntegerv(GL_VIEWPORT, &viewport[0]);
  glViewport(viewport[0], viewport[1], new_size, new_size);
  return;
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    116b <reshape+0x2b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1173 <reshape+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <glGetFloatv@plt>
cvtsi2ssq -0x30(%rbp),%xmm0
movss  0xe65(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    11be <reshape+0x7e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    11d4 <reshape+0x94>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <glPointSize@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0x2e63(%rip),%rsi
call   1050 <glGetIntegerv@plt>
mov    0x2e58(%rip),%edi
mov    0x2e56(%rip),%esi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1060 <glViewport@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    %rsi,%rdi
cmovl  %rdi,%rbx
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1040 <glGetFloatv@plt>
cvtsi2ss %rbx,%xmm0
divss  0xe93(%rip),%xmm0
cvttss2si %xmm0,%rdi
mov    (%rsp),%rax
cmp    %rdi,%rax
cmovg  %rax,%rdi
mov    0x8(%rsp),%rax
cmp    %rax,%rdi
cmovg  %rax,%rdi
call   1030 <glPointSize@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0x2eb2(%rip),%rsi
call   1050 <glGetIntegerv@plt>
mov    0x2ea7(%rip),%edi
mov    0x2ea5(%rip),%esi
mov    %rbx,%rdx
mov    %rbx,%rcx
call   1060 <glViewport@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@reshape.viewport = internal global [4 x i32] zeroinitializer
@GL_POINT_SIZE_RANGE = global i32 0
@GL_VIEWPORT = global i32 0
define void @reshape(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca [2 x i64]
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = icmp slt i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i64, i64* %3
br label %15
13: ; preds = %2
%14 = load i64, i64* %4
br label %15
15: ; preds = %13, %11
%16 = phi i64 [ %12, %11 ], [ %14, %13 ]
store i64 %16, i64* %7
%17 = load i32, i32* @GL_POINT_SIZE_RANGE
%18 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0, i64 0
%19 = call i32 @glGetFloatv(i32 %17, i64* %18)
%20 = load i64, i64* %7
%21 = sitofp i64 %20 to float
%22 = fdiv float %21, 2.500000e+01
%23 = fptosi float %22 to i64
store i64 %23, i64* %6
%24 = load i64, i64* %6
%25 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0, i64 0
%26 = load i64, i64* %25
%27 = icmp slt i64 %24, %26
br i1 %27, label %28, label %31
28: ; preds = %15
%29 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0, i64 0
%30 = load i64, i64* %29
store i64 %30, i64* %6
br label %31
31: ; preds = %28, %15
%32 = load i64, i64* %6
%33 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0, i64 1
%34 = load i64, i64* %33
%35 = icmp sgt i64 %32, %34
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0, i64 1
%38 = load i64, i64* %37
store i64 %38, i64* %6
br label %39
39: ; preds = %36, %31
%40 = load i64, i64* %6
%41 = call i32 @glPointSize(i64 %40)
%42 = load i32, i32* @GL_VIEWPORT
%43 = call i32 @glGetIntegerv(i32 %42, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 0))
%44 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 0)
%45 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 1)
%46 = load i64, i64* %7
%47 = load i64, i64* %7
%48 = call i32 @glViewport(i32 %44, i32 %45, i64 %46, i64 %47)
ret void
}

LLVM IR (-O2):
@reshape.viewport = internal global [4 x i32] zeroinitializer
@GL_POINT_SIZE_RANGE = global i32 0
@GL_VIEWPORT = global i32 0
define void @reshape(i64 %0, i64 %1) {
%3 = alloca [2 x i64]
%4 = bitcast [2 x i64]* %3 to i8*
%5 = icmp slt i64 %0, %1
%6 = select i1 %5, i64 %0, i64 %1
%7 = load i32, i32* @GL_POINT_SIZE_RANGE
%8 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
%9 = call i32 @glGetFloatv(i32 %7, i64* %8)
%10 = sitofp i64 %6 to float
%11 = fdiv float %10, 2.500000e+01
%12 = fptosi float %11 to i64
%13 = load i64, i64* %8
%14 = icmp sgt i64 %13, %12
%15 = select i1 %14, i64 %13, i64 %12
%16 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 1
%17 = load i64, i64* %16
%18 = icmp sgt i64 %15, %17
%19 = select i1 %18, i64 %17, i64 %15
%20 = call i32 @glPointSize(i64 %19)
%21 = load i32, i32* @GL_VIEWPORT
%22 = call i32 @glGetIntegerv(i32 %21, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 0))
%23 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 0)
%24 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @reshape.viewport, i64 0, i64 1)
%25 = call i32 @glViewport(i32 %23, i32 %24, i64 %6, i64 %6)
ret void
}