#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_QUADS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glTexCoord2f(int, int);
int /*<<< orphan*/ glVertex2f(int, int);
void draw_rect(int w, int h) {
  glBegin(GL_QUADS);
  glTexCoord2f(0, 0);
  glVertex2f(0, 0);
  glTexCoord2f(1, 0);
  glVertex2f(w, 0);
  glTexCoord2f(1, 1);
  glVertex2f(w, h);
  glTexCoord2f(0, 1);
  glVertex2f(0, h);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_rect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <glTexCoord2f@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <glVertex2f@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <glTexCoord2f@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1040 <glVertex2f@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <glTexCoord2f@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glVertex2f@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <glTexCoord2f@plt>
mov    -0x8(%rbp),%esi
xor    %edi,%edi
call   1040 <glVertex2f@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_rect>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <glTexCoord2f@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <glVertex2f@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <glTexCoord2f@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <glVertex2f@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <glTexCoord2f@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <glVertex2f@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <glTexCoord2f@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <glVertex2f@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_QUADS = global i32 0
define void @draw_rect(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @GL_QUADS
%6 = call i32 @glBegin(i32 %5)
%7 = call i32 @glTexCoord2f(i32 0, i32 0)
%8 = call i32 @glVertex2f(i32 0, i32 0)
%9 = call i32 @glTexCoord2f(i32 1, i32 0)
%10 = load i32, i32* %3
%11 = call i32 @glVertex2f(i32 %10, i32 0)
%12 = call i32 @glTexCoord2f(i32 1, i32 1)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @glVertex2f(i32 %13, i32 %14)
%16 = call i32 @glTexCoord2f(i32 0, i32 1)
%17 = load i32, i32* %4
%18 = call i32 @glVertex2f(i32 0, i32 %17)
%19 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_QUADS = global i32 0
define void @draw_rect(i32 %0, i32 %1) {
%3 = load i32, i32* @GL_QUADS
%4 = tail call i32 @glBegin(i32 %3)
%5 = tail call i32 @glTexCoord2f(i32 0, i32 0)
%6 = tail call i32 @glVertex2f(i32 0, i32 0)
%7 = tail call i32 @glTexCoord2f(i32 1, i32 0)
%8 = tail call i32 @glVertex2f(i32 %0, i32 0)
%9 = tail call i32 @glTexCoord2f(i32 1, i32 1)
%10 = tail call i32 @glVertex2f(i32 %0, i32 %1)
%11 = tail call i32 @glTexCoord2f(i32 0, i32 1)
%12 = tail call i32 @glVertex2f(i32 0, i32 %1)
%13 = tail call i32 (...) @glEnd()
ret void
}