#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*/ printf(char *, char, ...);
void fill_area_XY(int x1, int y1, int x2, int y2, char Fill) {
  int cx, cy;
  for (cy = (y2 > y1 ? y1 : y2); cy <= (y2 > y1 ? y2 : y1); cy++) {
    printf("\033[%d;%dH", cy, x1);
    for (cx = 0; cx <= (x2 > x1 ? x2 - x1 : x1 - x2); cx++)
      printf("%c", Fill);
  }
}


x86 assembly (clang, -O0):
<fill_area_XY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r8b,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1141 <fill_area_XY+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1147 <fill_area_XY+0x37>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    116a <fill_area_XY+0x5a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1170 <fill_area_XY+0x60>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x28(%rbp),%ecx
cmp    %ecx,%eax
jg     1206 <fill_area_XY+0xf6>
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%edx
lea    0xe75(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    11bc <fill_area_XY+0xac>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    11c5 <fill_area_XY+0xb5>
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
cmp    %ecx,%eax
jg     11f3 <fill_area_XY+0xe3>
lea    0xe2f(%rip),%rdi
movsbl -0x11(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119c <fill_area_XY+0x8c>
jmp    11f8 <fill_area_XY+0xe8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <fill_area_XY+0x3d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_area_XY>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r13d
mov    %esi,%r12d
mov    %edx,%eax
sub    %edi,%eax
neg    %eax
mov    %edi,0x4(%rsp)
sub    %edi,%r13d
cmovle %eax,%r13d
cmp    %esi,%ecx
mov    %ecx,%r15d
cmovg  %esi,%r15d
cmovg  %ecx,%r12d
lea    0x1(%r13),%eax
mov    %eax,(%rsp)
movsbl %r8b,%ebp
lea    0xeb8(%rip),%rbx
jmp    116c <fill_area_XY+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r15),%eax
cmp    %r12d,%r15d
mov    %eax,%r15d
je     11a4 <fill_area_XY+0x94>
movsbl %r15b,%esi
lea    0xe89(%rip),%rdi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
test   %r13d,%r13d
js     1160 <fill_area_XY+0x50>
mov    (%rsp),%r14d
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%r14d
jne    1190 <fill_area_XY+0x80>
jmp    1160 <fill_area_XY+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
@.str.1 = [3 x i8] c"%c\00"
define void @fill_area_XY(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8 %4, i8* %10
%13 = load i32, i32* %9
%14 = load i32, i32* %7
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = load i32, i32* %7
br label %20
18: ; preds = %5
%19 = load i32, i32* %9
br label %20
20: ; preds = %18, %16
%21 = phi i32 [ %17, %16 ], [ %19, %18 ]
store i32 %21, i32* %12
br label %22
22: ; preds = %62, %20
%23 = load i32, i32* %12
%24 = load i32, i32* %9
%25 = load i32, i32* %7
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = load i32, i32* %9
br label %31
29: ; preds = %22
%30 = load i32, i32* %7
br label %31
31: ; preds = %29, %27
%32 = phi i32 [ %28, %27 ], [ %30, %29 ]
%33 = icmp sle i32 %23, %32
br i1 %33, label %34, label %65
34: ; preds = %31
%35 = load i32, i32* %12
%36 = trunc i32 %35 to i8
%37 = load i32, i32* %6
%38 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %36, i32 %37)
store i32 0, i32* %11
br label %39
39: ; preds = %58, %34
%40 = load i32, i32* %11
%41 = load i32, i32* %8
%42 = load i32, i32* %6
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = load i32, i32* %8
%46 = load i32, i32* %6
%47 = sub nsw i32 %45, %46
br label %52
48: ; preds = %39
%49 = load i32, i32* %6
%50 = load i32, i32* %8
%51 = sub nsw i32 %49, %50
br label %52
52: ; preds = %48, %44
%53 = phi i32 [ %47, %44 ], [ %51, %48 ]
%54 = icmp sle i32 %40, %53
br i1 %54, label %55, label %61
55: ; preds = %52
%56 = load i8, i8* %10
%57 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %56)
br label %58
58: ; preds = %55
%59 = load i32, i32* %11
%60 = add nsw i32 %59, 1
store i32 %60, i32* %11
br label %39
61: ; preds = %52
br label %62
62: ; preds = %61
%63 = load i32, i32* %12
%64 = add nsw i32 %63, 1
store i32 %64, i32* %12
br label %22
65: ; preds = %31
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
@.str.1 = [3 x i8] c"%c\00"
define void @fill_area_XY(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4) {
%6 = icmp sgt i32 %3, %1
%7 = select i1 %6, i32 %1, i32 %3
%8 = select i1 %6, i32 %3, i32 %1
%9 = icmp sgt i32 %2, %0
%10 = sub nsw i32 %2, %0
%11 = sub nsw i32 %0, %2
%12 = select i1 %9, i32 %10, i32 %11
%13 = icmp slt i32 %12, 0
br label %14
14: ; preds = %5, %23
%15 = phi i32 [ %7, %5 ], [ %24, %23 ]
%16 = trunc i32 %15 to i8
%17 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %16, i32 %0)
br i1 %13, label %23, label %18
18: ; preds = %14, %18
%19 = phi i32 [ %21, %18 ], [ 0, %14 ]
%20 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %19, %12
br i1 %22, label %23, label %18
23: ; preds = %18, %14
%24 = add i32 %15, 1
%25 = icmp eq i32 %15, %8
br i1 %25, label %26, label %14
26: ; preds = %23
ret void
}