#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 GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glClearColor(int, double, double, double);
int test06(int size, int num) {
  int y;
  for (y = 0; y < num; y++) {
    glClearColor(y / (float)num, 0.1, 1.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }
  return num;
}


x86 assembly (clang, -O0):
<test06>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1190 <test06+0x70>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
movsd  0xea5(%rip),%xmm0
movsd  0xea5(%rip),%xmm1
xorps  %xmm2,%xmm2
call   1040 <glClearColor@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    0x2e6d(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <test06+0x15>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test06>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
test   %esi,%esi
jle    118b <test06+0x6b>
cvtsi2ss %ebx,%xmm0
movss  %xmm0,0x4(%rsp)
xor    %ebp,%ebp
mov    0x2e98(%rip),%r14
mov    0x2ea1(%rip),%r15
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
divss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%edi
xorps  %xmm2,%xmm2
movsd  0xe94(%rip),%xmm0
movsd  0xe94(%rip),%xmm1
call   1040 <glClearColor@plt>
mov    (%r15),%edi
or     (%r14),%edi
call   1030 <glClear@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1150 <test06+0x30>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define i32 @test06(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %22, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to float
%15 = fdiv float %12, %14
%16 = fptosi float %15 to i32
%17 = call i32 @glClearColor(i32 %16, double 1.000000e-01, double 1.000000e+00, double 0.000000e+00)
%18 = load i32, i32* @GL_COLOR_BUFFER_BIT
%19 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%20 = or i32 %18, %19
%21 = call i32 @glClear(i32 %20)
br label %22
22: ; preds = %10
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define i32 @test06(i32 %0, i32 returned %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = sitofp i32 %1 to float
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %16, %6 ]
%8 = sitofp i32 %7 to float
%9 = fdiv float %8, %5
%10 = fptosi float %9 to i32
%11 = tail call i32 @glClearColor(i32 %10, double 1.000000e-01, double 1.000000e+00, double 0.000000e+00)
%12 = load i32, i32* @GL_COLOR_BUFFER_BIT
%13 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%14 = or i32 %13, %12
%15 = tail call i32 @glClear(i32 %14)
%16 = add nuw nsw i32 %7, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %18, label %6
18: ; preds = %6, %2
ret i32 %1
}