#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*/ PrintTty(int, int, char *);
int /*<<< orphan*/ nSleep(int);
void DoHairCut(char child, int row, int delay) {
  int time = 0;
  while (time < delay * 1000) {
    PrintTty(row, 60 + 5, ">%%");
    nSleep(50 * 2);
    PrintTty(row, 60 + 5, "-%%");
    nSleep(50 * 2);
    time += 50 * 4;
  }
  PrintTty(row, 60 + 2, " ");
  PrintTty(row, 60 + 5, "  ");
}


x86 assembly (clang, -O0):
<DoHairCut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   $0x3e8,-0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    1199 <DoHairCut+0x79>
mov    -0x8(%rbp),%edi
mov    $0x41,%esi
lea    0xea4(%rip),%rdx
call   1040 <PrintTty@plt>
mov    $0x64,%edi
call   1030 <nSleep@plt>
mov    -0x8(%rbp),%edi
mov    $0x41,%esi
lea    0xe8a(%rip),%rdx
call   1040 <PrintTty@plt>
mov    $0x64,%edi
call   1030 <nSleep@plt>
mov    -0x10(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <DoHairCut+0x1b>
mov    -0x8(%rbp),%edi
mov    $0x3e,%esi
lea    0xe61(%rip),%rdx
call   1040 <PrintTty@plt>
mov    -0x8(%rbp),%edi
mov    $0x41,%esi
lea    0xe4c(%rip),%rdx
call   1040 <PrintTty@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoHairCut>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
test   %edx,%edx
jle    118d <DoHairCut+0x6d>
imul   $0x3e8,%edx,%r12d
xor    %ebp,%ebp
lea    0xec2(%rip),%r14
lea    0xebf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    $0x41,%esi
mov    %r14,%rdx
call   1040 <PrintTty@plt>
mov    $0x64,%edi
call   1030 <nSleep@plt>
mov    %ebx,%edi
mov    $0x41,%esi
mov    %r15,%rdx
call   1040 <PrintTty@plt>
mov    $0x64,%edi
call   1030 <nSleep@plt>
add    $0xc8,%ebp
cmp    %r12d,%ebp
jl     1150 <DoHairCut+0x30>
lea    0xe75(%rip),%rdx
mov    %ebx,%edi
mov    $0x3e,%esi
call   1040 <PrintTty@plt>
lea    0xe61(%rip),%rdx
mov    %ebx,%edi
mov    $0x41,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <PrintTty@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c">%%\00"
@.str.1 = [4 x i8] c"-%%\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c" \00"
define void @DoHairCut(i8 signext %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, 1000
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %14
6: ; preds = %3, %6
%7 = phi i32 [ %12, %6 ], [ 0, %3 ]
%8 = tail call i32 @PrintTty(i32 %1, i32 65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @nSleep(i32 100)
%10 = tail call i32 @PrintTty(i32 %1, i32 65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @nSleep(i32 100)
%12 = add nuw nsw i32 %7, 200
%13 = icmp slt i32 %12, %4
br i1 %13, label %6, label %14
14: ; preds = %6, %3
%15 = tail call i32 @PrintTty(i32 %1, i32 62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @PrintTty(i32 %1, i32 65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}