#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_POINTS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2i(int, int);
int test01(int size, int num) {
  int x, y;
  glBegin(GL_POINTS);
  for (y = 0; y < num; y++)
    for (x = 0; x < 480; x++)
      glVertex2i(x, x);
  glEnd();
  return 480 * num;
}


x86 assembly (clang, -O0):
<test01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    119f <test01+0x6f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1e0,-0xc(%rbp)
jge    118c <test01+0x5c>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <glVertex2i@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <test01+0x36>
jmp    1191 <test01+0x61>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <test01+0x23>
mov    $0x0,%al
call   1040 <glEnd@plt>
imul   $0x1e0,-0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test01>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
test   %r14d,%r14d
jle    117c <test01+0x4c>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %ebp,%esi
call   1030 <glVertex2i@plt>
add    $0x1,%ebp
cmp    $0x1e0,%ebp
jne    1160 <test01+0x30>
add    $0x1,%ebx
cmp    %r14d,%ebx
jne    1150 <test01+0x20>
xor    %eax,%eax
call   1040 <glEnd@plt>
imul   $0x1e0,%r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@GL_POINTS = global i32 0
define i32 @test01(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* @GL_POINTS
%8 = call i32 @glBegin(i32 %7)
store i32 0, i32* %6
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
store i32 0, i32* %5
br label %14
14: ; preds = %21, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 480
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %5
%19 = load i32, i32* %5
%20 = call i32 @glVertex2i(i32 %18, i32 %19)
br label %21
21: ; preds = %17
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %14
24: ; preds = %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %9
28: ; preds = %9
%29 = call i32 (...) @glEnd()
%30 = load i32, i32* %4
%31 = mul nsw i32 480, %30
ret i32 %31
}

LLVM IR (-O2):
@GL_POINTS = global i32 0
define i32 @test01(i32 %0, i32 %1) {
%3 = load i32, i32* @GL_POINTS
%4 = tail call i32 @glBegin(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %16
6: ; preds = %2, %13
%7 = phi i32 [ %14, %13 ], [ 0, %2 ]
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ 0, %6 ], [ %11, %8 ]
%10 = tail call i32 @glVertex2i(i32 %9, i32 %9)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, 480
br i1 %12, label %13, label %8
13: ; preds = %8
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, %1
br i1 %15, label %16, label %6
16: ; preds = %13, %2
%17 = tail call i32 (...) @glEnd()
%18 = mul nsw i32 %1, 480
ret i32 %18
}