#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*/ SetPixel(unsigned long, unsigned long, char);
void DrawRectangle(unsigned long x1, unsigned long x2, unsigned long y1,
                   unsigned long y2, char color) {
  unsigned long xOffset;
  unsigned long yOffset;
  for (yOffset = y1; yOffset <= y2; yOffset++) {
    for (xOffset = x1; xOffset <= x2; xOffset++) {
      SetPixel(xOffset, yOffset, color);
    }
  }
}


x86 assembly (clang, -O0):
<DrawRectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8b,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %al,-0x21(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     1192 <DrawRectangle+0x82>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     117c <DrawRectangle+0x6c>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
movsbl -0x21(%rbp),%edx
call   1030 <SetPixel@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    114c <DrawRectangle+0x3c>
jmp    1181 <DrawRectangle+0x71>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1136 <DrawRectangle+0x26>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawRectangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %rcx,%rdx
jbe    112f <DrawRectangle+0x1f>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
movsbl %r8b,%r13d
jmp    1159 <DrawRectangle+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %r14,%rbx
ja     1120 <DrawRectangle+0x10>
cmp    %r15,%r12
ja     1150 <DrawRectangle+0x40>
mov    %r12,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
call   1030 <SetPixel@plt>
add    $0x1,%rbp
cmp    %r15,%rbp
jbe    1170 <DrawRectangle+0x60>
jmp    1150 <DrawRectangle+0x40>

LLVM IR (-O0):
define void @DrawRectangle(i64 %0, i64 %1, i64 %2, i64 %3, i8 signext %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i8 %4, i8* %10
%13 = load i64, i64* %8
store i64 %13, i64* %12
br label %14
14: ; preds = %33, %5
%15 = load i64, i64* %12
%16 = load i64, i64* %9
%17 = icmp ule i64 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %14
%19 = load i64, i64* %6
store i64 %19, i64* %11
br label %20
20: ; preds = %29, %18
%21 = load i64, i64* %11
%22 = load i64, i64* %7
%23 = icmp ule i64 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i64, i64* %11
%26 = load i64, i64* %12
%27 = load i8, i8* %10
%28 = call i32 @SetPixel(i64 %25, i64 %26, i8 signext %27)
br label %29
29: ; preds = %24
%30 = load i64, i64* %11
%31 = add i64 %30, 1
store i64 %31, i64* %11
br label %20
32: ; preds = %20
br label %33
33: ; preds = %32
%34 = load i64, i64* %12
%35 = add i64 %34, 1
store i64 %35, i64* %12
br label %14
36: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @DrawRectangle(i64 %0, i64 %1, i64 %2, i64 %3, i8 signext %4) {
%6 = icmp ugt i64 %2, %3
br i1 %6, label %19, label %7
7: ; preds = %5
%8 = icmp ugt i64 %0, %1
br label %9
9: ; preds = %7, %16
%10 = phi i64 [ %2, %7 ], [ %17, %16 ]
br i1 %8, label %16, label %11
11: ; preds = %9, %11
%12 = phi i64 [ %14, %11 ], [ %0, %9 ]
%13 = tail call i32 @SetPixel(i64 %12, i64 %10, i8 signext %4)
%14 = add i64 %12, 1
%15 = icmp ugt i64 %14, %1
br i1 %15, label %16, label %11
16: ; preds = %11, %9
%17 = add i64 %10, 1
%18 = icmp ugt i64 %17, %3
br i1 %18, label %19, label %9
19: ; preds = %16, %5
ret void
}