#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 put_row(int w, int doorsize, int isknob) {
  int i;
  i = 0;
  if (doorsize) {
    while (i++ < w / 2 - doorsize / 2)
      ft_putchar('*');
    i = 0;
    if (isknob) {
      while (i++ < doorsize - 2)
        ft_putchar('|');
      ft_putchar('$');
      ft_putchar('|');
    } else
      while (i++ < doorsize)
        ft_putchar('|');
    i = 0;
    while (i++ < w / 2 - doorsize / 2)
      ft_putchar('*');
  } else
    while (i++ < w)
      ft_putchar('*');
}


x86 assembly (clang, -O0):
<put_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     124b <put_row+0x13b>
jmp    1137 <put_row+0x27>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x14(%rbp),%eax
sub    %edx,%ecx
cmp    %ecx,%eax
jge    1179 <put_row+0x69>
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
jmp    1137 <put_row+0x27>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11d0 <put_row+0xc0>
jmp    118f <put_row+0x7f>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    11b7 <put_row+0xa7>
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
jmp    118f <put_row+0x7f>
mov    $0x24,%edi
call   1030 <ft_putchar@plt>
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
jmp    11fd <put_row+0xed>
jmp    11d5 <put_row+0xc5>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cmp    -0x8(%rbp),%eax
jge    11f8 <put_row+0xe8>
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
jmp    11d5 <put_row+0xc5>
jmp    11fd <put_row+0xed>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x18(%rbp),%eax
sub    %edx,%ecx
cmp    %ecx,%eax
jge    1246 <put_row+0x136>
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
jmp    1204 <put_row+0xf4>
jmp    1278 <put_row+0x168>
jmp    1250 <put_row+0x140>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cmp    -0x4(%rbp),%eax
jge    1273 <put_row+0x163>
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
jmp    1250 <put_row+0x140>
jmp    1278 <put_row+0x168>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_row>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
test   %esi,%esi
je     1195 <put_row+0x85>
mov    %edx,%r14d
mov    %esi,%ebx
mov    %ebp,%r15d
shr    $0x1f,%r15d
add    %ebp,%r15d
sar    %r15d
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
sub    %eax,%r15d
test   %r15d,%r15d
jle    115f <put_row+0x4f>
mov    %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebp
jne    1150 <put_row+0x40>
test   %r14d,%r14d
je     11b1 <put_row+0xa1>
cmp    $0x3,%ebx
jl     117f <put_row+0x6f>
add    $0xfffffffe,%ebx
nopl   0x0(%rax)
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <put_row+0x60>
mov    $0x24,%edi
call   1030 <ft_putchar@plt>
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
jmp    11cf <put_row+0xbf>
test   %ebp,%ebp
jle    11f0 <put_row+0xe0>
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <put_row+0x90>
jmp    11f0 <put_row+0xe0>
test   %ebx,%ebx
jle    11cf <put_row+0xbf>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x7c,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebx
jne    11c0 <put_row+0xb0>
test   %r15d,%r15d
jle    11f0 <put_row+0xe0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%r15d
jne    11e0 <put_row+0xd0>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @put_row(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %59
10: ; preds = %3
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %7
%13 = add nsw i32 %12, 1
store i32 %13, i32* %7
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 2
%16 = load i32, i32* %5
%17 = sdiv i32 %16, 2
%18 = sub nsw i32 %15, %17
%19 = icmp slt i32 %12, %18
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = call i32 @ft_putchar(i8 signext 42)
br label %11
22: ; preds = %11
store i32 0, i32* %7
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %37
25: ; preds = %22
br label %26
26: ; preds = %32, %25
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
%29 = load i32, i32* %5
%30 = sub nsw i32 %29, 2
%31 = icmp slt i32 %27, %30
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 @ft_putchar(i8 signext 124)
br label %26
34: ; preds = %26
%35 = call i32 @ft_putchar(i8 signext 36)
%36 = call i32 @ft_putchar(i8 signext 124)
br label %46
37: ; preds = %22
br label %38
38: ; preds = %43, %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
%41 = load i32, i32* %5
%42 = icmp slt i32 %39, %41
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 @ft_putchar(i8 signext 124)
br label %38
45: ; preds = %38
br label %46
46: ; preds = %45, %34
store i32 0, i32* %7
br label %47
47: ; preds = %56, %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = load i32, i32* %4
%51 = sdiv i32 %50, 2
%52 = load i32, i32* %5
%53 = sdiv i32 %52, 2
%54 = sub nsw i32 %51, %53
%55 = icmp slt i32 %48, %54
br i1 %55, label %56, label %58
56: ; preds = %47
%57 = call i32 @ft_putchar(i8 signext 42)
br label %47
58: ; preds = %47
br label %68
59: ; preds = %3
br label %60
60: ; preds = %65, %59
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
%63 = load i32, i32* %4
%64 = icmp slt i32 %61, %63
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = call i32 @ft_putchar(i8 signext 42)
br label %60
67: ; preds = %60
br label %68
68: ; preds = %67, %58
ret void
}

LLVM IR (-O2):
define void @put_row(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = sdiv i32 %0, 2
%7 = sdiv i32 %1, -2
%8 = add nsw i32 %7, %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %12, label %17
10: ; preds = %3
%11 = icmp sgt i32 %0, 0
br i1 %11, label %43, label %48
12: ; preds = %5, %12
%13 = phi i32 [ %14, %12 ], [ 0, %5 ]
%14 = add nuw nsw i32 %13, 1
%15 = tail call i32 @ft_putchar(i8 signext 42)
%16 = icmp eq i32 %14, %8
br i1 %16, label %17, label %12
17: ; preds = %12, %5
%18 = icmp eq i32 %2, 0
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = add i32 %1, -2
%21 = icmp sgt i32 %1, 2
br i1 %21, label %24, label %29
22: ; preds = %17
%23 = icmp sgt i32 %1, 0
br i1 %23, label %32, label %37
24: ; preds = %19, %24
%25 = phi i32 [ %26, %24 ], [ 0, %19 ]
%26 = add nuw nsw i32 %25, 1
%27 = tail call i32 @ft_putchar(i8 signext 124)
%28 = icmp eq i32 %26, %20
br i1 %28, label %29, label %24
29: ; preds = %24, %19
%30 = tail call i32 @ft_putchar(i8 signext 36)
%31 = tail call i32 @ft_putchar(i8 signext 124)
br label %37
32: ; preds = %22, %32
%33 = phi i32 [ %34, %32 ], [ 0, %22 ]
%34 = add nuw nsw i32 %33, 1
%35 = tail call i32 @ft_putchar(i8 signext 124)
%36 = icmp eq i32 %34, %1
br i1 %36, label %37, label %32
37: ; preds = %32, %22, %29
br i1 %9, label %38, label %48
38: ; preds = %37, %38
%39 = phi i32 [ %40, %38 ], [ 0, %37 ]
%40 = add nuw nsw i32 %39, 1
%41 = tail call i32 @ft_putchar(i8 signext 42)
%42 = icmp eq i32 %40, %8
br i1 %42, label %48, label %38
43: ; preds = %10, %43
%44 = phi i32 [ %45, %43 ], [ 0, %10 ]
%45 = add nuw nsw i32 %44, 1
%46 = tail call i32 @ft_putchar(i8 signext 42)
%47 = icmp eq i32 %45, %0
br i1 %47, label %48, label %43
48: ; preds = %38, %43, %37, %10
ret void
}