#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*/ draw_rectangle(float *, int, int, int, int, int, int, float);
void sivine256(float *sl, int w, int h) {
  int i, j, w1, h1;
  float s;
  draw_rectangle(sl, w, h, 0, 0, w, h, 0.5);
  if (w > h)
    w1 = h / 20;
  else
    w1 = w / 20;
  h1 = w1 - 2;
  for (i = 0; i < 16; i++)
    for (j = 0; j < 16; j++) {
      s = (float)(16 * i + j) / 255.0;
      draw_rectangle(sl, w, h, (w - h) / 2 + (j + 2) * w1, (i + 2) * w1, h1, h1,
                     s);
    }
}


x86 assembly (clang, -O0):
<sivine256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r9d
mov    -0x10(%rbp),%eax
xor    %r8d,%r8d
movss  0xec2(%rip),%xmm0
mov    %r8d,%ecx
mov    %eax,(%rsp)
call   1030 <draw_rectangle@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1168 <sivine256+0x58>
mov    -0x10(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    1176 <sivine256+0x66>
mov    -0xc(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1235 <sivine256+0x125>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1222 <sivine256+0x112>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
add    -0x18(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%edx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    $0x2,%eax
imul   -0x1c(%rbp),%eax
add    %eax,%ecx
mov    -0x14(%rbp),%r8d
add    $0x2,%r8d
imul   -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x20(%rbp),%eax
movss  -0x24(%rbp),%xmm0
mov    %eax,(%rsp)
call   1030 <draw_rectangle@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1197 <sivine256+0x87>
jmp    1227 <sivine256+0x117>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <sivine256+0x76>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sivine256>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r13
mov    %edx,(%rsp)
xor    %r15d,%r15d
movss  0xecd(%rip),%xmm0
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %esi,%r9d
call   1030 <draw_rectangle@plt>
mov    %ebx,%edx
mov    %ebp,%eax
sub    %ebx,%eax
mov    %ebp,%ecx
cmovg  %ebx,%ecx
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x23,%rcx
lea    (%rcx,%rsi,1),%edi
lea    (%rcx,%rsi,1),%r9d
add    $0xfffffffe,%r9d
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
lea    (%rcx,%rdi,2),%eax
mov    %eax,0x8(%rsp)
movss  0xe81(%rip),%xmm1
xor    %eax,%eax
mov    %rdi,0x18(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rax,0x10(%rsp)
add    $0x2,%eax
imul   %edi,%eax
mov    %eax,0xc(%rsp)
mov    0x8(%rsp),%ebx
xor    %r12d,%r12d
mov    %r15,0x20(%rsp)
nopl   0x0(%rax,%rax,1)
lea    (%r15,%r12,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm1,%xmm0
mov    %r9d,(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %ebx,%ecx
mov    %edx,%r14d
mov    0xc(%rsp),%r8d
mov    %r9d,%r15d
call   1030 <draw_rectangle@plt>
movss  0xe22(%rip),%xmm1
mov    %r15d,%r9d
mov    0x18(%rsp),%rdi
mov    %r14d,%edx
mov    0x20(%rsp),%r15
add    $0x1,%r12d
add    %edi,%ebx
cmp    $0x10,%r12d
jne    11b0 <sivine256+0xa0>
mov    0x10(%rsp),%rax
add    $0x1,%eax
add    $0x10,%r15d
cmp    $0x10,%eax
jne    1190 <sivine256+0x80>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sivine256(float* %0, i32 %1, i32 %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
store float* %0, float** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load float*, float** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @draw_rectangle(float* %12, i32 %13, i32 %14, i32 0, i32 0, i32 %15, i32 %16, float 5.000000e-01)
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i32, i32* %6
%23 = sdiv i32 %22, 20
store i32 %23, i32* %9
br label %27
24: ; preds = %3
%25 = load i32, i32* %5
%26 = sdiv i32 %25, 20
store i32 %26, i32* %9
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %9
%29 = sub nsw i32 %28, 2
store i32 %29, i32* %10
store i32 0, i32* %7
br label %30
30: ; preds = %70, %27
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 16
br i1 %32, label %33, label %73
33: ; preds = %30
store i32 0, i32* %8
br label %34
34: ; preds = %66, %33
%35 = load i32, i32* %8
%36 = icmp slt i32 %35, 16
br i1 %36, label %37, label %69
37: ; preds = %34
%38 = load i32, i32* %7
%39 = mul nsw i32 16, %38
%40 = load i32, i32* %8
%41 = add nsw i32 %39, %40
%42 = sitofp i32 %41 to float
%43 = fpext float %42 to double
%44 = fdiv double %43, 2.550000e+02
%45 = fptrunc double %44 to float
store float %45, float* %11
%46 = load float*, float** %4
%47 = load i32, i32* %5
%48 = load i32, i32* %6
%49 = load i32, i32* %5
%50 = load i32, i32* %6
%51 = sub nsw i32 %49, %50
%52 = sdiv i32 %51, 2
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 2
%55 = load i32, i32* %9
%56 = mul nsw i32 %54, %55
%57 = add nsw i32 %52, %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 2
%60 = load i32, i32* %9
%61 = mul nsw i32 %59, %60
%62 = load i32, i32* %10
%63 = load i32, i32* %10
%64 = load float, float* %11
%65 = call i32 @draw_rectangle(float* %46, i32 %47, i32 %48, i32 %57, i32 %61, i32 %62, i32 %63, float %64)
br label %66
66: ; preds = %37
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
br label %34
69: ; preds = %34
br label %70
70: ; preds = %69
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %30
73: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @sivine256(float* %0, i32 %1, i32 %2) {
%4 = tail call i32 @draw_rectangle(float* %0, i32 %1, i32 %2, i32 0, i32 0, i32 %1, i32 %2, float 5.000000e-01)
%5 = icmp sgt i32 %1, %2
%6 = select i1 %5, i32 %2, i32 %1
%7 = sdiv i32 %6, 20
%8 = add nsw i32 %7, -2
%9 = sub nsw i32 %1, %2
%10 = sdiv i32 %9, 2
br label %11
11: ; preds = %3, %27
%12 = phi i32 [ 0, %3 ], [ %28, %27 ]
%13 = shl nsw i32 %12, 4
%14 = add nuw nsw i32 %12, 2
%15 = mul nsw i32 %14, %7
br label %16
16: ; preds = %11, %16
%17 = phi i32 [ 0, %11 ], [ %25, %16 ]
%18 = add nuw nsw i32 %17, %13
%19 = sitofp i32 %18 to float
%20 = fdiv float %19, 2.550000e+02
%21 = add nuw nsw i32 %17, 2
%22 = mul nsw i32 %21, %7
%23 = add nsw i32 %22, %10
%24 = tail call i32 @draw_rectangle(float* %0, i32 %1, i32 %2, i32 %23, i32 %15, i32 %8, i32 %8, float %20)
%25 = add nuw nsw i32 %17, 1
%26 = icmp eq i32 %25, 16
br i1 %26, label %27, label %16
27: ; preds = %16
%28 = add nuw nsw i32 %12, 1
%29 = icmp eq i32 %28, 16
br i1 %29, label %30, label %11
30: ; preds = %27
ret void
}