#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*/ color(int);
int /*<<< orphan*/ draw2(double, double);
int /*<<< orphan*/ move2(double, double);
int /*<<< orphan*/ rect(double, double, double, double);
void drawgrid() {
  float x;
  int i;
  color(2);
  rect(0.1, 0.4, 0.9, 0.6);
  x = 0.2;
  for (i = 0; i < 8; i++) {
    move2(x, 0.4);
    draw2(x, 0.6);
    x += 0.1;
  }
  move2(0.1, 0.5);
  draw2(0.9, 0.5);
  color(3);
}


x86 assembly (clang, -O0):
<drawgrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2,%edi
call   1050 <color@plt>
movsd  0xeae(%rip),%xmm0
movsd  0xeae(%rip),%xmm1
movsd  0xeae(%rip),%xmm2
movsd  0xeae(%rip),%xmm3
call   1030 <rect@plt>
movss  0xe81(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    11ed <drawgrid+0xad>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6a(%rip),%xmm1
call   1060 <move2@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe64(%rip),%xmm1
call   1040 <draw2@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe36(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <drawgrid+0x4b>
movsd  0xe13(%rip),%xmm0
movsd  0xe2b(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe0e(%rip),%xmm0
movsd  0xe16(%rip),%xmm1
call   1040 <draw2@plt>
mov    $0x3,%edi
call   1050 <color@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawgrid>:
push   %rax
mov    $0x2,%edi
call   1050 <color@plt>
movsd  0xead(%rip),%xmm0
movsd  0xead(%rip),%xmm1
movsd  0xead(%rip),%xmm2
movsd  0xead(%rip),%xmm3
call   1030 <rect@plt>
movsd  0xea8(%rip),%xmm0
movsd  0xe88(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe93(%rip),%xmm0
movsd  0xe83(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xe86(%rip),%xmm0
movsd  0xe5e(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe71(%rip),%xmm0
movsd  0xe59(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xe64(%rip),%xmm0
movsd  0xe34(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe4f(%rip),%xmm0
movsd  0xe2f(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xe42(%rip),%xmm0
movsd  0xe0a(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe2d(%rip),%xmm0
movsd  0xe05(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xe20(%rip),%xmm0
movsd  0xde0(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xe0b(%rip),%xmm0
movsd  0xddb(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xdfe(%rip),%xmm0
movsd  0xdb6(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xde9(%rip),%xmm0
movsd  0xdb1(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xddc(%rip),%xmm0
movsd  0xd8c(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xdc7(%rip),%xmm0
movsd  0xd87(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xdba(%rip),%xmm0
movsd  0xd62(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xda5(%rip),%xmm0
movsd  0xd5d(%rip),%xmm1
call   1040 <draw2@plt>
movsd  0xd38(%rip),%xmm0
movsd  0xd68(%rip),%xmm1
call   1060 <move2@plt>
movsd  0xd33(%rip),%xmm0
movsd  0xd53(%rip),%xmm1
call   1040 <draw2@plt>
mov    $0x3,%edi
pop    %rax
jmp    1050 <color@plt>

LLVM IR (-O0):
define void @drawgrid() {
%1 = alloca float
%2 = alloca i32
%3 = call i32 @color(i32 2)
%4 = call i32 @rect(double 1.000000e-01, double 4.000000e-01, double 9.000000e-01, double 6.000000e-01)
store float 0x3FC99999A0000000, float* %1
store i32 0, i32* %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i32 @move2(double %10, double 4.000000e-01)
%12 = load float, float* %1
%13 = fpext float %12 to double
%14 = call i32 @draw2(double %13, double 6.000000e-01)
%15 = load float, float* %1
%16 = fpext float %15 to double
%17 = fadd double %16, 1.000000e-01
%18 = fptrunc double %17 to float
store float %18, float* %1
br label %19
19: ; preds = %8
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %5
22: ; preds = %5
%23 = call i32 @move2(double 1.000000e-01, double 5.000000e-01)
%24 = call i32 @draw2(double 9.000000e-01, double 5.000000e-01)
%25 = call i32 @color(i32 3)
ret void
}

LLVM IR (-O2):
define void @drawgrid() {
%1 = tail call i32 @color(i32 2)
%2 = tail call i32 @rect(double 1.000000e-01, double 4.000000e-01, double 9.000000e-01, double 6.000000e-01)
%3 = tail call i32 @move2(double 0x3FC99999A0000000, double 4.000000e-01)
%4 = tail call i32 @draw2(double 0x3FC99999A0000000, double 6.000000e-01)
%5 = tail call i32 @move2(double 0x3FD3333340000000, double 4.000000e-01)
%6 = tail call i32 @draw2(double 0x3FD3333340000000, double 6.000000e-01)
%7 = tail call i32 @move2(double 0x3FD99999A0000000, double 4.000000e-01)
%8 = tail call i32 @draw2(double 0x3FD99999A0000000, double 6.000000e-01)
%9 = tail call i32 @move2(double 5.000000e-01, double 4.000000e-01)
%10 = tail call i32 @draw2(double 5.000000e-01, double 6.000000e-01)
%11 = tail call i32 @move2(double 0x3FE3333340000000, double 4.000000e-01)
%12 = tail call i32 @draw2(double 0x3FE3333340000000, double 6.000000e-01)
%13 = tail call i32 @move2(double 0x3FE6666680000000, double 4.000000e-01)
%14 = tail call i32 @draw2(double 0x3FE6666680000000, double 6.000000e-01)
%15 = tail call i32 @move2(double 0x3FE99999C0000000, double 4.000000e-01)
%16 = tail call i32 @draw2(double 0x3FE99999C0000000, double 6.000000e-01)
%17 = tail call i32 @move2(double 0x3FECCCCD00000000, double 4.000000e-01)
%18 = tail call i32 @draw2(double 0x3FECCCCD00000000, double 6.000000e-01)
%19 = tail call i32 @move2(double 1.000000e-01, double 5.000000e-01)
%20 = tail call i32 @draw2(double 9.000000e-01, double 5.000000e-01)
%21 = tail call i32 @color(i32 3)
ret void
}