#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*/ DrawText(int, int, int, int, int);
void TextBox(int x1, int y1, int x2, int y2, int ch, int foreground,
             int background) {
  int x;
  int y;
  for (x = x1; x <= x2; x++) {
    for (y = y1; y <= y2; y++) {
      DrawText(x, y, ch, foreground, background);
    }
  }
}


x86 assembly (clang, -O0):
<TextBox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1189 <TextBox+0x79>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1176 <TextBox+0x66>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    0x10(%rbp),%r8d
call   1030 <DrawText@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1147 <TextBox+0x37>
jmp    117b <TextBox+0x6b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1135 <TextBox+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TextBox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %esi,0x8(%rsp)
mov    %edx,0xc(%rsp)
cmp    %edx,%edi
jle    113e <TextBox+0x2e>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r9d,%r13d
mov    %r8d,%ebp
mov    %edi,%ebx
mov    0x50(%rsp),%r14d
mov    0x10(%rsp),%rax
lea    0x1(%rax),%r15d
jmp    116b <TextBox+0x5b>
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
je     112f <TextBox+0x1f>
mov    0x8(%rsp),%eax
cmp    0x10(%rsp),%eax
jg     1160 <TextBox+0x50>
mov    0x8(%rsp),%r12d
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
call   1030 <DrawText@plt>
add    $0x1,%r12d
cmp    %r12d,%r15d
jne    1180 <TextBox+0x70>
jmp    1160 <TextBox+0x50>

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

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