#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 my_base(int);
int /*<<< orphan*/ my_display(int, char);
int /*<<< orphan*/ write(int, char *, int);
void my_leaves(int size) {
  int counter_size;
  int counter_floor;
  int floor;
  int space;
  int star;
  int length;
  int withdrawal;
  counter_size = 0;
  floor = 4;
  star = 1;
  length = my_base(size);
  space = ((length - 1) / 2);
  withdrawal = 0;
  while (size <= 0) {
    return;
  }
  while (counter_size < size) {
    counter_floor = 0;
    while (counter_floor < floor) {
      my_display(space, ' ');
      my_display(star, '*');
      write(1, "\n", 1);
      counter_floor++;
      space = space - 1;
      star = star + 2;
    }
    floor++;
    counter_size++;
    withdrawal = (counter_size / 2) * 2;
    star = ((star - 2) - withdrawal);
    space = ((space + 1) + (withdrawal / 2));
  }
}


x86 assembly (clang, -O0):
<my_leaves>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <my_base@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1182 <my_leaves+0x52>
jmp    1245 <my_leaves+0x115>
jmp    1187 <my_leaves+0x57>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1245 <my_leaves+0x115>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f3 <my_leaves+0xc3>
mov    -0x14(%rbp),%edi
mov    $0x20,%esi
call   1040 <my_display@plt>
mov    -0x18(%rbp),%edi
mov    $0x2a,%esi
call   1040 <my_display@plt>
mov    $0x1,%edx
lea    0xe34(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    119a <my_leaves+0x6a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1187 <my_leaves+0x57>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_leaves>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
call   1050 <my_base@plt>
mov    %ebx,(%rsp)
test   %ebx,%ebx
jle    1200 <my_leaves+0xd0>
mov    %eax,%ecx
add    $0xffffffff,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%r12d
add    $0xffffffff,%r12d
sar    %r12d
mov    $0x4,%r13d
xor    %eax,%eax
mov    $0x1,%ecx
lea    0xe89(%rip),%r15
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    %eax,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ecx,%eax
shr    %eax
mov    %rax,0x10(%rsp)
add    %eax,%eax
xor    $0xfffffffe,%eax
mov    %eax,0x4(%rsp)
mov    %r12d,%ebx
xor    %r14d,%r14d
mov    %ebx,%edi
mov    $0x20,%esi
call   1040 <my_display@plt>
mov    %ebp,%edi
mov    $0x2a,%esi
call   1040 <my_display@plt>
mov    $0x1,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x1,%r14d
add    $0xffffffff,%ebx
add    $0x2,%ebp
cmp    %r14d,%r13d
jne    11a0 <my_leaves+0x70>
add    $0x1,%r13d
mov    0xc(%rsp),%eax
add    $0x1,%eax
add    0x4(%rsp),%ebp
add    0x10(%rsp),%r12d
sub    %r14d,%r12d
add    $0x1,%r12d
mov    0x8(%rsp),%ecx
add    $0x1,%ecx
cmp    (%rsp),%eax
jne    1180 <my_leaves+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @my_leaves(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 4, i32* %5
store i32 1, i32* %7
%10 = load i32, i32* %2
%11 = call i32 @my_base(i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = sub nsw i32 %12, 1
%14 = sdiv i32 %13, 2
store i32 %14, i32* %6
store i32 0, i32* %9
br label %15
15: ; preds = %1
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %58
19: ; preds = %15
br label %20
20: ; preds = %41, %19
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %58
24: ; preds = %20
store i32 0, i32* %4
br label %25
25: ; preds = %29, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i32, i32* %6
%31 = call i32 @my_display(i32 %30, i8 signext 32)
%32 = load i32, i32* %7
%33 = call i32 @my_display(i32 %32, i8 signext 42)
%34 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
%37 = load i32, i32* %6
%38 = sub nsw i32 %37, 1
store i32 %38, i32* %6
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 2
store i32 %40, i32* %7
br label %25
41: ; preds = %25
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
%46 = load i32, i32* %3
%47 = sdiv i32 %46, 2
%48 = mul nsw i32 %47, 2
store i32 %48, i32* %9
%49 = load i32, i32* %7
%50 = sub nsw i32 %49, 2
%51 = load i32, i32* %9
%52 = sub nsw i32 %50, %51
store i32 %52, i32* %7
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %9
%56 = sdiv i32 %55, 2
%57 = add nsw i32 %54, %56
store i32 %57, i32* %6
br label %20
58: ; preds = %18, %20
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @my_leaves(i32 %0) {
%2 = tail call i32 @my_base(i32 %0)
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %31
4: ; preds = %1
%5 = add nsw i32 %2, -1
%6 = sdiv i32 %5, 2
br label %7
7: ; preds = %4, %23
%8 = phi i32 [ %25, %23 ], [ 0, %4 ]
%9 = phi i32 [ %28, %23 ], [ 1, %4 ]
%10 = phi i32 [ %29, %23 ], [ %6, %4 ]
%11 = phi i32 [ %24, %23 ], [ 4, %4 ]
br label %12
12: ; preds = %7, %12
%13 = phi i32 [ %9, %7 ], [ %21, %12 ]
%14 = phi i32 [ %10, %7 ], [ %20, %12 ]
%15 = phi i32 [ 0, %7 ], [ %19, %12 ]
%16 = tail call i32 @my_display(i32 %14, i8 signext 32)
%17 = tail call i32 @my_display(i32 %13, i8 signext 42)
%18 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%19 = add nuw nsw i32 %15, 1
%20 = add nsw i32 %14, -1
%21 = add nsw i32 %13, 2
%22 = icmp eq i32 %19, %11
br i1 %22, label %23, label %12
23: ; preds = %12
%24 = add nuw nsw i32 %11, 1
%25 = add nuw nsw i32 %8, 1
%26 = lshr i32 %25, 1
%27 = and i32 %25, 2147483646
%28 = sub i32 %13, %27
%29 = add i32 %26, %14
%30 = icmp eq i32 %25, %0
br i1 %30, label %31, label %7
31: ; preds = %23, %1
ret void
}