#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*/ ft_putchar(char);
void ft_print_door(int door_width, int dollar_line) {
  int i;
  int dollar_location_x;
  i = 0;
  dollar_location_x = door_width - 1;
  while (i <= door_width) {
    if (i == dollar_location_x && dollar_line)
      ft_putchar('$');
    else
      ft_putchar('|');
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_print_door>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1177 <ft_print_door+0x67>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    115f <ft_print_door+0x4f>
cmpl   $0x0,-0x8(%rbp)
je     115f <ft_print_door+0x4f>
mov    $0x24,%edi
call   1030 <ft_putchar@plt>
jmp    1169 <ft_print_door+0x59>
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <ft_print_door+0x1e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_print_door>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
js     114c <ft_print_door+0x3c>
mov    %esi,%ebx
mov    %edi,%ebp
add    $0x1,%ebp
mov    $0x24,%r14d
mov    $0x7c,%r15d
xchg   %ax,%ax
cmp    $0x2,%ebp
mov    $0x7c,%edi
cmove  %r14d,%edi
test   %ebx,%ebx
cmove  %r15d,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <ft_print_door+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ft_print_door(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -1
%4 = icmp slt i32 %0, 0
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = icmp ne i32 %1, 0
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ 0, %5 ], [ %13, %7 ]
%9 = icmp eq i32 %8, %3
%10 = and i1 %6, %9
%11 = select i1 %10, i8 36, i8 124
%12 = tail call i32 @ft_putchar(i8 signext %11)
%13 = add nuw i32 %8, 1
%14 = icmp eq i32 %8, %0
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret void
}