#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_trunk(int size) {
  int s_counter;
  int trunk_counter;
  int b_counter;
  int blank;
  int pipe;
  int length;
  s_counter = 0;
  trunk_counter = 0;
  length = my_base(size);
  blank = ((length - size) / 2);
  pipe = (1 + ((size / 2) * 2));
  while (s_counter < size) {
    while (trunk_counter < size) {
      trunk_counter++;
      b_counter = 0;
      while (b_counter < blank) {
        write(1, " ", 1);
        b_counter++;
      }
      my_display(pipe, '|');
      write(1, "\n", 1);
      blank = blank--;
    }
    s_counter++;
  }
  return;
}


x86 assembly (clang, -O0):
<my_trunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <my_base@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1214 <my_trunk+0xe4>
jmp    118a <my_trunk+0x5a>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1206 <my_trunk+0xd6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d3 <my_trunk+0xa3>
mov    $0x1,%edx
lea    0xe42(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a6 <my_trunk+0x76>
mov    -0x18(%rbp),%edi
mov    $0x7c,%esi
call   1040 <my_display@plt>
mov    $0x1,%edx
lea    0xe16(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
mov    %eax,-0x14(%rbp)
jmp    118a <my_trunk+0x5a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <my_trunk+0x49>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_trunk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
call   1050 <my_base@plt>
test   %r13d,%r13d
jle    11fa <my_trunk+0xca>
mov    %eax,%r14d
sub    %r13d,%r14d
mov    %r14d,%eax
shr    $0x1f,%eax
add    %r14d,%eax
sar    %eax
mov    %eax,0x4(%rsp)
mov    %r13d,%ebx
shr    $0x1f,%ebx
add    %r13d,%ebx
or     $0x1,%ebx
xor    %eax,%eax
lea    0xe8a(%rip),%rbp
xor    %r15d,%r15d
jmp    118e <my_trunk+0x5e>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%r15d
mov    (%rsp),%eax
add    $0x1,%eax
cmp    %r13d,%eax
je     11fa <my_trunk+0xca>
cmp    %r13d,%r15d
jge    1186 <my_trunk+0x56>
mov    %eax,(%rsp)
jmp    11c7 <my_trunk+0x97>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x7c,%esi
call   1040 <my_display@plt>
mov    $0x1,%edi
lea    0xe4a(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    %r13d,%r15d
je     1180 <my_trunk+0x50>
add    $0x1,%r15d
cmp    $0x2,%r14d
jl     11a0 <my_trunk+0x70>
mov    0x4(%rsp),%r12d
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffff,%r12d
jne    11e0 <my_trunk+0xb0>
jmp    11a0 <my_trunk+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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