#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*/ addch(char);
int /*<<< orphan*/ move(int, int);
void clear_area(int fromY, int toY, int fromX, int toX) {
  move(fromY, fromX);
  int curX = fromX, curY = fromY;
  while (curY <= toY) {
    addch(' ');
    curX++;
    if (curX == toX) {
      curX = 0;
      curY++;
      move(curY, 0);
    }
  }
}


x86 assembly (clang, -O0):
<clear_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <move@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1195 <clear_area+0x75>
mov    $0x20,%edi
call   1030 <addch@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1190 <clear_area+0x70>
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   1040 <move@plt>
jmp    114b <clear_area+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_area>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%ebx
mov    %edx,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1040 <move@plt>
cmp    %r15d,%ebx
jg     1167 <clear_area+0x47>
mov    $0x20,%edi
call   1030 <addch@plt>
add    $0x1,%ebp
cmp    %r14d,%ebp
jne    1145 <clear_area+0x25>
add    $0x1,%ebx
xor    %ebp,%ebp
mov    %ebx,%edi
xor    %esi,%esi
jmp    1140 <clear_area+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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