#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 atoi(char *);
int /*<<< orphan*/ draw_triangle(int, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int base;
  if (argc < 2) {
    fputs("ERROR: You did not give enough arguments.\n", stderr);
    exit(1);
  }
  base = atoi(argv[1]);
  if (!(base % 2)) {
    draw_triangle(base, base / 2, 1);
    draw_triangle(base, 0, 2);
  } else
    draw_triangle(base, 0, 1);
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
lea    0xe90(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d1 <main+0x91>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <draw_triangle@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <draw_triangle@plt>
jmp    11e0 <main+0xa0>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <draw_triangle@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    1182 <main+0x42>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    $0x1,%edx
test   $0x1,%bl
jne    1175 <main+0x35>
mov    %ebx,%esi
shr    $0x1f,%esi
add    %ebx,%esi
sar    %esi
mov    %ebx,%edi
mov    $0x1,%edx
call   1040 <draw_triangle@plt>
mov    $0x2,%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1040 <draw_triangle@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
lea    0xe6e(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"ERROR: You did not give enough arguments.\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fputs(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = srem i32 %18, 2
%20 = icmp ne i32 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %13
%22 = load i32, i32* %6
%23 = load i32, i32* %6
%24 = sdiv i32 %23, 2
%25 = call i32 @draw_triangle(i32 %22, i32 %24, i32 1)
%26 = load i32, i32* %6
%27 = call i32 @draw_triangle(i32 %26, i32 0, i32 2)
br label %31
28: ; preds = %13
%29 = load i32, i32* %6
%30 = call i32 @draw_triangle(i32 %29, i32 0, i32 1)
br label %31
31: ; preds = %28, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"ERROR: You did not give enough arguments.\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = and i32 %11, 1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = sdiv i32 %11, 2
%16 = tail call i32 @draw_triangle(i32 %11, i32 %15, i32 1)
br label %17
17: ; preds = %8, %14
%18 = phi i32 [ 2, %14 ], [ 1, %8 ]
%19 = tail call i32 @draw_triangle(i32 %11, i32 0, i32 %18)
ret i32 0
}