#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*/ console_write(char *, int);
void console_whiteout(int n) {
  int t;
  for (t = 0; t < n; t++)
    console_write(" ", 1);
  for (t = 0; t < n; t++)
    console_write("\b", 1);
}


x86 assembly (clang, -O0):
<console_whiteout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114d <console_whiteout+0x3d>
lea    0xecb(%rip),%rdi
mov    $0x1,%esi
call   1030 <console_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <console_whiteout+0x12>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117f <console_whiteout+0x6f>
lea    0xe9b(%rip),%rdi
mov    $0x1,%esi
call   1030 <console_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <console_whiteout+0x44>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_whiteout>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1162 <console_whiteout+0x52>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
mov    %edi,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <console_write@plt>
add    $0xffffffff,%ebp
jne    1130 <console_whiteout+0x20>
test   %ebx,%ebx
jle    1162 <console_whiteout+0x52>
lea    0xeb5(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <console_write@plt>
add    $0xffffffff,%ebx
jne    1150 <console_whiteout+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\08\00"
define void @console_whiteout(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @console_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
store i32 0, i32* %3
br label %14
14: ; preds = %20, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = call i32 @console_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %20
20: ; preds = %18
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %14
23: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\08\00"
define void @console_whiteout(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %14
3: ; preds = %4
br i1 %2, label %9, label %14
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @console_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ 0, %3 ]
%11 = tail call i32 @console_write(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %9
14: ; preds = %9, %1, %3
ret void
}