#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 EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  if (argc != 4) {
    fprintf(stderr,
            "Usage: %s HEIGHT BASECHAR TREECHAR\n"
            "Where:\n"
            "\tHEIGHT is between 3 and 21 inclusive "
            "and is odd,\n"
            "\tand BASECHAR and TREECHAR are single characters.\n",
            argv[0]);
    return 1;
    ;
  }
  char rows = (char)strtol(argv[1], NULL, 10);
  if (rows < 3 || rows > 21 || (rows % 2) != 1) {
    fprintf(stderr,
            "Usage: %s HEIGHT BASECHAR TREECHAR\n"
            "Where:\n"
            "\tHEIGHT is between 3 and 21 inclusive "
            "and is odd,\n"
            "\tand BASECHAR and TREECHAR are single characters.\n",
            argv[0]);
    return 1;
    ;
  }
  char tree_rows = rows - 1;
  char final_row_width = (tree_rows * 2) - 1;
  for (int i = 0; i < tree_rows; i++) {
    char padding = (final_row_width / 2) - i;
    char row_width = ((i * 2) + 1);
    for (int j = 0; j < padding; j++)
      putchar((int)' ');
    for (int j = 0; j < row_width; j++)
      putchar((int)argv[3][0]);
    putchar('\n');
  }
  char bottom_padding = (final_row_width - 3) / 2;
  for (int i = 0; i < bottom_padding; i++)
    putchar((int)' ');
  for (int i = 0; i < 3; i++)
    putchar((int)argv[2][0]);
  putchar('\n');
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1178 <main+0x48>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1338 <main+0x208>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x3,%eax
jl     11c0 <main+0x90>
movsbl -0x11(%rbp),%eax
cmp    $0x15,%eax
jg     11c0 <main+0x90>
movsbl -0x11(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
je     11e8 <main+0xb8>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe29(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1338 <main+0x208>
movsbl -0x11(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %al,-0x13(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    12b0 <main+0x180>
movsbl -0x13(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    -0x18(%rbp),%eax
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %al,-0x1a(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jge    1261 <main+0x131>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    123a <main+0x10a>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
movsbl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
jge    1298 <main+0x168>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movsbl (%rax),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1268 <main+0x138>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1206 <main+0xd6>
movsbl -0x13(%rbp),%eax
sub    $0x3,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %al,-0x25(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
movsbl -0x25(%rbp),%ecx
cmp    %ecx,%eax
jge    12f0 <main+0x1c0>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12c9 <main+0x199>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    1322 <main+0x1f2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12f7 <main+0x1c7>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    1233 <main+0x103>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ecx
shl    $0x18,%ecx
add    $0xeaffffff,%ecx
cmp    $0xedffffff,%ecx
jb     1233 <main+0x103>
mov    %eax,%ecx
and    $0x1,%ecx
test   %rcx,%rcx
je     1233 <main+0x103>
add    $0xff,%eax
lea    (%rax,%rax,1),%ecx
add    $0xff,%cl
mov    %ecx,0xc(%rsp)
and    $0xff,%eax
je     1252 <main+0x122>
mov    0xc(%rsp),%ecx
mov    %ecx,%r13d
shr    %r13b
xor    %r14d,%r14d
mov    %r13b,0xb(%rsp)
xor    %r12d,%r12d
mov    %rax,0x10(%rsp)
jmp    11e0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
add    $0xff,%r13b
add    $0x2,%r14b
mov    0x10(%rsp),%rax
cmp    %eax,%r12d
je     1252 <main+0x122>
mov    0xb(%rsp),%al
sub    %r12b,%al
lea    (%r12,%r12,1),%r15d
or     $0x1,%r15b
test   %al,%al
jle    120f <main+0xdf>
movsbl %r13b,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0xd0>
test   %r15b,%r15b
jle    11c0 <main+0x90>
movsbl %r14b,%ebp
add    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x18(%rbx),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0xf0>
jmp    11c0 <main+0x90>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdba(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    12b6 <main+0x186>
movzbl 0xc(%rsp),%eax
add    $0xfffffffd,%eax
movzwl %ax,%eax
mov    %eax,%ecx
shr    $0xf,%ecx
add    %eax,%ecx
shr    %ecx
movzbl %cl,%ebp
test   %ebp,%ebp
je     127f <main+0x14f>
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1270 <main+0x140>
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [143 x i8] c"Usage: %s HEIGHT BASECHAR TREECHAR\0AWhere:\0A\09HEIGHT is between 3 and 21 inclusive and is odd,\0A\09and BASECHAR and TREECHAR are single characters.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 4
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %23)
store i32 1, i32* %3
br label %143
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strtol(i8* %28, i32* null, i32 10)
%30 = trunc i64 %29 to i8
store i8 %30, i8* %6
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
%33 = icmp slt i32 %32, 3
br i1 %33, label %43, label %34
34: ; preds = %25
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = icmp sgt i32 %36, 21
br i1 %37, label %43, label %38
38: ; preds = %34
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
%41 = srem i32 %40, 2
%42 = icmp ne i32 %41, 1
br i1 %42, label %43, label %49
43: ; preds = %38, %34, %25
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %47)
store i32 1, i32* %3
br label %143
49: ; preds = %38
%50 = load i8, i8* %6
%51 = sext i8 %50 to i32
%52 = sub nsw i32 %51, 1
%53 = trunc i32 %52 to i8
store i8 %53, i8* %7
%54 = load i8, i8* %7
%55 = sext i8 %54 to i32
%56 = mul nsw i32 %55, 2
%57 = sub nsw i32 %56, 1
%58 = trunc i32 %57 to i8
store i8 %58, i8* %8
store i32 0, i32* %9
br label %59
59: ; preds = %105, %49
%60 = load i32, i32* %9
%61 = load i8, i8* %7
%62 = sext i8 %61 to i32
%63 = icmp slt i32 %60, %62
br i1 %63, label %64, label %108
64: ; preds = %59
%65 = load i8, i8* %8
%66 = sext i8 %65 to i32
%67 = sdiv i32 %66, 2
%68 = load i32, i32* %9
%69 = sub nsw i32 %67, %68
%70 = trunc i32 %69 to i8
store i8 %70, i8* %10
%71 = load i32, i32* %9
%72 = mul nsw i32 %71, 2
%73 = add nsw i32 %72, 1
%74 = trunc i32 %73 to i8
store i8 %74, i8* %11
store i32 0, i32* %12
br label %75
75: ; preds = %82, %64
%76 = load i32, i32* %12
%77 = load i8, i8* %10
%78 = sext i8 %77 to i32
%79 = icmp slt i32 %76, %78
br i1 %79, label %80, label %85
80: ; preds = %75
%81 = call i32 @putchar(i8 signext 32)
br label %82
82: ; preds = %80
%83 = load i32, i32* %12
%84 = add nsw i32 %83, 1
store i32 %84, i32* %12
br label %75
85: ; preds = %75
store i32 0, i32* %13
br label %86
86: ; preds = %100, %85
%87 = load i32, i32* %13
%88 = load i8, i8* %11
%89 = sext i8 %88 to i32
%90 = icmp slt i32 %87, %89
br i1 %90, label %91, label %103
91: ; preds = %86
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 3
%94 = load i8*, i8** %93
%95 = getelementptr inbounds i8, i8* %94, i64 0
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = trunc i32 %97 to i8
%99 = call i32 @putchar(i8 signext %98)
br label %100
100: ; preds = %91
%101 = load i32, i32* %13
%102 = add nsw i32 %101, 1
store i32 %102, i32* %13
br label %86
103: ; preds = %86
%104 = call i32 @putchar(i8 signext 10)
br label %105
105: ; preds = %103
%106 = load i32, i32* %9
%107 = add nsw i32 %106, 1
store i32 %107, i32* %9
br label %59
108: ; preds = %59
%109 = load i8, i8* %8
%110 = sext i8 %109 to i32
%111 = sub nsw i32 %110, 3
%112 = sdiv i32 %111, 2
%113 = trunc i32 %112 to i8
store i8 %113, i8* %14
store i32 0, i32* %15
br label %114
114: ; preds = %121, %108
%115 = load i32, i32* %15
%116 = load i8, i8* %14
%117 = sext i8 %116 to i32
%118 = icmp slt i32 %115, %117
br i1 %118, label %119, label %124
119: ; preds = %114
%120 = call i32 @putchar(i8 signext 32)
br label %121
121: ; preds = %119
%122 = load i32, i32* %15
%123 = add nsw i32 %122, 1
store i32 %123, i32* %15
br label %114
124: ; preds = %114
store i32 0, i32* %16
br label %125
125: ; preds = %137, %124
%126 = load i32, i32* %16
%127 = icmp slt i32 %126, 3
br i1 %127, label %128, label %140
128: ; preds = %125
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 2
%131 = load i8*, i8** %130
%132 = getelementptr inbounds i8, i8* %131, i64 0
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = trunc i32 %134 to i8
%136 = call i32 @putchar(i8 signext %135)
br label %137
137: ; preds = %128
%138 = load i32, i32* %16
%139 = add nsw i32 %138, 1
store i32 %139, i32* %16
br label %125
140: ; preds = %125
%141 = call i32 @putchar(i8 signext 10)
%142 = load i32, i32* @EXIT_SUCCESS
store i32 %142, i32* %3
br label %143
143: ; preds = %140, %43, %19
%144 = load i32, i32* %3
ret i32 %144
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [143 x i8] c"Usage: %s HEIGHT BASECHAR TREECHAR\0AWhere:\0A\09HEIGHT is between 3 and 21 inclusive and is odd,\0A\09and BASECHAR and TREECHAR are single characters.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %90
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strtol(i8* nocapture %10, i32* null, i32 10)
%12 = trunc i64 %11 to i32
%13 = shl i32 %12, 24
%14 = add i32 %13, -352321537
%15 = icmp ult i32 %14, -301989889
%16 = and i64 %11, 1
%17 = icmp eq i64 %16, 0
%18 = select i1 %15, i1 true, i1 %17
br i1 %18, label %19, label %23
19: ; preds = %8
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %1
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %90
23: ; preds = %8
%24 = add i32 %12, 255
%25 = and i32 %24, 255
%26 = trunc i32 %24 to i8
%27 = shl i8 %26, 1
%28 = add i8 %27, -1
%29 = icmp eq i32 %25, 0
br i1 %29, label %33, label %30
30: ; preds = %23
%31 = lshr i8 %28, 1
%32 = getelementptr inbounds i8*, i8** %1, i64 3
br label %40
33: ; preds = %59, %23
%34 = zext i8 %28 to i16
%35 = add nsw i16 %34, -3
%36 = sdiv i16 %35, 2
%37 = and i16 %36, 255
%38 = zext i16 %37 to i32
%39 = icmp eq i16 %37, 0
br i1 %39, label %72, label %85
40: ; preds = %30, %59
%41 = phi i8 [ 0, %30 ], [ %63, %59 ]
%42 = phi i8 [ %31, %30 ], [ %62, %59 ]
%43 = phi i32 [ 0, %30 ], [ %61, %59 ]
%44 = or i8 %41, 1
%45 = sext i8 %44 to i32
%46 = sext i8 %42 to i32
%47 = trunc i32 %43 to i8
%48 = sub i8 %31, %47
%49 = shl i8 %47, 1
%50 = or i8 %49, 1
%51 = icmp sgt i8 %48, 0
br i1 %51, label %54, label %52
52: ; preds = %54, %40
%53 = icmp sgt i8 %50, 0
br i1 %53, label %65, label %59
54: ; preds = %40, %54
%55 = phi i32 [ %57, %54 ], [ 0, %40 ]
%56 = tail call i32 @putchar(i8 signext 32)
%57 = add nuw nsw i32 %55, 1
%58 = icmp eq i32 %57, %46
br i1 %58, label %52, label %54
59: ; preds = %65, %52
%60 = tail call i32 @putchar(i8 signext 10)
%61 = add nuw nsw i32 %43, 1
%62 = add i8 %42, -1
%63 = add i8 %41, 2
%64 = icmp eq i32 %61, %25
br i1 %64, label %33, label %40
65: ; preds = %52, %65
%66 = phi i32 [ %70, %65 ], [ 0, %52 ]
%67 = load i8*, i8** %32
%68 = load i8, i8* %67
%69 = tail call i32 @putchar(i8 signext %68)
%70 = add nuw nsw i32 %66, 1
%71 = icmp eq i32 %70, %45
br i1 %71, label %59, label %65
72: ; preds = %85, %33
%73 = getelementptr inbounds i8*, i8** %1, i64 2
%74 = load i8*, i8** %73
%75 = load i8, i8* %74
%76 = tail call i32 @putchar(i8 signext %75)
%77 = load i8*, i8** %73
%78 = load i8, i8* %77
%79 = tail call i32 @putchar(i8 signext %78)
%80 = load i8*, i8** %73
%81 = load i8, i8* %80
%82 = tail call i32 @putchar(i8 signext %81)
%83 = tail call i32 @putchar(i8 signext 10)
%84 = load i32, i32* @EXIT_SUCCESS
br label %90
85: ; preds = %33, %85
%86 = phi i32 [ %88, %85 ], [ 0, %33 ]
%87 = tail call i32 @putchar(i8 signext 32)
%88 = add nuw nsw i32 %86, 1
%89 = icmp eq i32 %88, %38
br i1 %89, label %72, label %85
90: ; preds = %19, %72, %4
%91 = phi i32 [ 1, %4 ], [ 1, %19 ], [ %84, %72 ]
ret i32 %91
}