#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 */
typedef int /*<<< orphan*/ uint32_t;
typedef scalar_t__ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ fgui_set_pixel(scalar_t__, scalar_t__, int /*<<< orphan*/);
void fgui_fill_rectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
                         uint32_t color) {
  uint16_t xpos, ypos;
  for (ypos = y; ypos < y + h; ypos++) {
    for (xpos = x; xpos < x + w; xpos++) {
      fgui_set_pixel(xpos, ypos, color);
    }
  }
}


x86 assembly (clang, -O0):
<fgui_fill_rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jge    119d <fgui_fill_rectangle+0x8d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jge    1187 <fgui_fill_rectangle+0x77>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <fgui_set_pixel@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1151 <fgui_fill_rectangle+0x41>
jmp    118c <fgui_fill_rectangle+0x7c>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1134 <fgui_fill_rectangle+0x24>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgui_fill_rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %rcx,%rcx
jle    1179 <fgui_fill_rectangle+0x69>
mov    %r8d,%r13d
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
add    %rsi,%r14
mov    (%rsp),%rax
lea    (%rdx,%rax,1),%r12
jmp    1149 <fgui_fill_rectangle+0x39>
nopl   (%rax)
add    $0x1,%rbx
cmp    %r14,%rbx
jge    1179 <fgui_fill_rectangle+0x69>
test   %r15,%r15
jle    1140 <fgui_fill_rectangle+0x30>
mov    (%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
call   1030 <fgui_set_pixel@plt>
add    $0x1,%rbp
cmp    %r12,%rbp
jl     1160 <fgui_fill_rectangle+0x50>
jmp    1140 <fgui_fill_rectangle+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fgui_fill_rectangle(i64 %0, i64 %1, i64 %2, i64 %3, i32 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%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 i32 %4, i32* %10
%13 = load i64, i64* %7
store i64 %13, i64* %12
br label %14
14: ; preds = %37, %5
%15 = load i64, i64* %12
%16 = load i64, i64* %7
%17 = load i64, i64* %9
%18 = add nsw i64 %16, %17
%19 = icmp slt i64 %15, %18
br i1 %19, label %20, label %40
20: ; preds = %14
%21 = load i64, i64* %6
store i64 %21, i64* %11
br label %22
22: ; preds = %33, %20
%23 = load i64, i64* %11
%24 = load i64, i64* %6
%25 = load i64, i64* %8
%26 = add nsw i64 %24, %25
%27 = icmp slt i64 %23, %26
br i1 %27, label %28, label %36
28: ; preds = %22
%29 = load i64, i64* %11
%30 = load i64, i64* %12
%31 = load i32, i32* %10
%32 = call i32 @fgui_set_pixel(i64 %29, i64 %30, i32 %31)
br label %33
33: ; preds = %28
%34 = load i64, i64* %11
%35 = add nsw i64 %34, 1
store i64 %35, i64* %11
br label %22
36: ; preds = %22
br label %37
37: ; preds = %36
%38 = load i64, i64* %12
%39 = add nsw i64 %38, 1
store i64 %39, i64* %12
br label %14
40: ; preds = %14
ret void
}

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