#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 calc_base(int);
int /*<<< orphan*/ ft_putchar(char);
int /*<<< orphan*/ put_blocks(int, int, int, int);
int /*<<< orphan*/ put_line(int);
void sastantua(int dimention) {
  int etage;
  int taille;
  int phase;
  int largeur;
  if (dimention < 1)
    return;
  etage = 1;
  largeur = 1;
  while (etage <= dimention) {
    taille = 2 + etage;
    phase = 0;
    while (phase < taille) {
      largeur += 2;
      put_line((calc_base(dimention) - largeur) / 2);
      put_blocks(dimention, etage, largeur, phase);
      ft_putchar('\n');
      phase++;
    }
    etage++;
    largeur += 4 + 2 * ((etage - 2) / 2);
  }
}


x86 assembly (clang, -O0):
<sastantua>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    115a <sastantua+0x1a>
jmp    1204 <sastantua+0xc4>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1204 <sastantua+0xc4>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11dc <sastantua+0x9c>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <calc_base@plt>
sub    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <put_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1060 <put_blocks@plt>
mov    $0xa,%edi
call   1050 <ft_putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1184 <sastantua+0x44>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
add    $0x4,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1168 <sastantua+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sastantua>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    120e <sastantua+0xce>
mov    %edi,%r15d
lea    0x2(%r15),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%ebp
mov    $0x3,%r13d
mov    $0x4,%ecx
mov    $0x1,%r14d
nopw   0x0(%rax,%rax,1)
mov    %ecx,0x14(%rsp)
and    $0xfffffffe,%ecx
mov    %ecx,0x10(%rsp)
mov    %ebp,%r12d
neg    %r12d
add    $0x2,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%edi
call   1040 <calc_base@plt>
lea    (%rax,%r12,1),%ecx
add    $0xfffffffe,%ecx
add    %r12d,%eax
shr    $0x1f,%ecx
lea    (%rcx,%rax,1),%edi
add    $0xfffffffe,%edi
sar    %edi
call   1030 <put_line@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1060 <put_blocks@plt>
mov    $0xa,%edi
call   1050 <ft_putchar@plt>
add    $0x1,%ebx
add    $0xfffffffe,%r12d
add    $0x2,%ebp
cmp    %ebx,%r13d
jne    11a0 <sastantua+0x60>
add    $0x1,%r14d
mov    0x10(%rsp),%ebp
sub    %r12d,%ebp
lea    0x1(%r13),%eax
mov    0x14(%rsp),%ecx
add    $0x1,%ecx
cmp    0xc(%rsp),%r13d
mov    %eax,%r13d
jne    1180 <sastantua+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sastantua(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %1
br label %49
10: ; preds = %1
store i32 1, i32* %3
store i32 1, i32* %6
br label %11
11: ; preds = %39, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %49
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 2, %16
store i32 %17, i32* %4
store i32 0, i32* %5
br label %18
18: ; preds = %22, %15
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %39
22: ; preds = %18
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 2
store i32 %24, i32* %6
%25 = load i32, i32* %2
%26 = call i32 @calc_base(i32 %25)
%27 = load i32, i32* %6
%28 = sub nsw i32 %26, %27
%29 = sdiv i32 %28, 2
%30 = call i32 @put_line(i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = call i32 @put_blocks(i32 %31, i32 %32, i32 %33, i32 %34)
%36 = call i32 @ft_putchar(i8 signext 10)
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %18
39: ; preds = %18
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
%42 = load i32, i32* %3
%43 = sub nsw i32 %42, 2
%44 = sdiv i32 %43, 2
%45 = mul nsw i32 2, %44
%46 = add nsw i32 4, %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, %46
store i32 %48, i32* %6
br label %11
49: ; preds = %9, %11
ret void
}

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