#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*/ dollar_line(int, int);
int /*<<< orphan*/ ft_putline(int);
int /*<<< orphan*/ ft_putline_door(int, int, int /*<<< orphan*/);
void ft_sastantua(int size) {
  int floor_height;
  int door_height;
  int line_size;
  int i;
  int j;
  int s;
  s = 0;
  i = 1;
  line_size = 0;
  door_height = size;
  while (i <= size) {
    j = 0;
    floor_height = i + 1;
    while (j <= floor_height) {
      line_size = ((s / 2) + 3);
      if (i != size)
        ft_putline(line_size);
      else if (i == size && j >= floor_height - door_height)
        ft_putline_door(line_size, size, dollar_line(door_height, j));
      j++;
      s++;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_sastantua>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1213 <ft_sastantua+0xe3>
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1205 <ft_sastantua+0xd5>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     11a8 <ft_sastantua+0x78>
mov    -0x10(%rbp),%edi
call   1050 <ft_putline@plt>
jmp    11ee <ft_sastantua+0xbe>
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    11e9 <ft_sastantua+0xb9>
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jl     11e9 <ft_sastantua+0xb9>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <dollar_line@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    %eax,%edx
call   1040 <ft_putline_door@plt>
jmp    11ee <ft_sastantua+0xbe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1172 <ft_sastantua+0x42>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <ft_sastantua+0x26>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_sastantua>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    11e2 <ft_sastantua+0xb2>
mov    %edi,%r14d
lea    0x2(%r14),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%eax
xor    %r12d,%r12d
mov    $0x3,%r13d
jmp    1185 <ft_sastantua+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%r13),%eax
add    %ebx,%r12d
cmp    0xc(%rsp),%r13d
mov    %eax,%r13d
mov    0x10(%rsp),%eax
je     11e2 <ft_sastantua+0xb2>
mov    %eax,%r15d
lea    0x1(%r15),%eax
mov    %eax,0x10(%rsp)
sub    %r14d,%eax
mov    %eax,0x14(%rsp)
xor    %ebx,%ebx
jmp    11af <ft_sastantua+0x7f>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1050 <ft_putline@plt>
add    $0x1,%ebx
cmp    %ebx,%r13d
je     1170 <ft_sastantua+0x40>
lea    (%r12,%rbx,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
add    $0x3,%ebp
cmp    %r14d,%r15d
jne    11a0 <ft_sastantua+0x70>
cmp    0x14(%rsp),%ebx
jl     11a7 <ft_sastantua+0x77>
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <dollar_line@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %eax,%edx
call   1040 <ft_putline_door@plt>
jmp    11a7 <ft_sastantua+0x77>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ft_sastantua(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %8
store i32 1, i32* %6
store i32 0, i32* %5
%9 = load i32, i32* %2
store i32 %9, i32* %4
br label %10
10: ; preds = %54, %1
%11 = load i32, i32* %6
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %57
14: ; preds = %10
store i32 0, i32* %7
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %49, %14
%18 = load i32, i32* %7
%19 = load i32, i32* %3
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %54
21: ; preds = %17
%22 = load i32, i32* %8
%23 = sdiv i32 %22, 2
%24 = add nsw i32 %23, 3
store i32 %24, i32* %5
%25 = load i32, i32* %6
%26 = load i32, i32* %2
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %21
%29 = load i32, i32* %5
%30 = call i32 @ft_putline(i32 %29)
br label %49
31: ; preds = %21
%32 = load i32, i32* %6
%33 = load i32, i32* %2
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %48
35: ; preds = %31
%36 = load i32, i32* %7
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = sub nsw i32 %37, %38
%40 = icmp sge i32 %36, %39
br i1 %40, label %41, label %48
41: ; preds = %35
%42 = load i32, i32* %5
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = load i32, i32* %7
%46 = call i32 @dollar_line(i32 %44, i32 %45)
%47 = call i32 @ft_putline_door(i32 %42, i32 %43, i32 %46)
br label %48
48: ; preds = %41, %35, %31
br label %49
49: ; preds = %48, %28
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %17
54: ; preds = %17
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %10
57: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @ft_sastantua(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %31, label %3
3: ; preds = %1
%4 = add i32 %0, 2
br label %8
5: ; preds = %27
%6 = add nuw i32 %9, 1
%7 = icmp eq i32 %9, %4
br i1 %7, label %31, label %8
8: ; preds = %3, %5
%9 = phi i32 [ 3, %3 ], [ %6, %5 ]
%10 = phi i32 [ 0, %3 ], [ %29, %5 ]
%11 = phi i32 [ 1, %3 ], [ %12, %5 ]
%12 = add nuw nsw i32 %11, 1
%13 = icmp eq i32 %11, %0
%14 = sub nsw i32 %12, %0
br label %15
15: ; preds = %8, %27
%16 = phi i32 [ %10, %8 ], [ %29, %27 ]
%17 = phi i32 [ 0, %8 ], [ %28, %27 ]
%18 = sdiv i32 %16, 2
%19 = add nsw i32 %18, 3
br i1 %13, label %22, label %20
20: ; preds = %15
%21 = tail call i32 @ft_putline(i32 %19)
br label %27
22: ; preds = %15
%23 = icmp slt i32 %17, %14
br i1 %23, label %27, label %24
24: ; preds = %22
%25 = tail call i32 @dollar_line(i32 %0, i32 %17)
%26 = tail call i32 @ft_putline_door(i32 %19, i32 %0, i32 %25)
br label %27
27: ; preds = %22, %24, %20
%28 = add nuw i32 %17, 1
%29 = add nsw i32 %16, 1
%30 = icmp eq i32 %28, %9
br i1 %30, label %5, label %15
31: ; preds = %5, %1
ret void
}