#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*/ atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printtriangle(char *, int /*<<< orphan*/);
main(int argc, char **argv) {
  printf("argc is %d\n", argc);
  if (argc != 4) {
    printf("Usage::\n");
    printf("rightsideuptriangle <character> <base>\n");
  } else {
    printtriangle(argv[1], atoi(argv[2]));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
je     1182 <main+0x52>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a6 <main+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <printtriangle@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x4,%ebp
jne    1176 <main+0x36>
mov    0x8(%rbx),%rbp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1050 <printtriangle@plt>
jmp    118e <main+0x4e>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"argc is %d\0A\00"
@.str.1 = [9 x i8] c"Usage::\0A\00"
@.str.2 = [40 x i8] c"rightsideuptriangle <character> <base>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 4
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %22
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = call i32 @printtriangle(i8* %16, i32 %20)
br label %22
22: ; preds = %13, %10
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [12 x i8] c"argc is %d\0A\00"
@str = [8 x i8] c"Usage::\00"
@str.3 = [39 x i8] c"rightsideuptriangle <character> <base>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = icmp eq i32 %0, 4
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.3, i64 0, i64 0))
br label %15
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 @printtriangle(i8* %10, i32 %13)
br label %15
15: ; preds = %8, %5
ret i32 0
}