#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stderr;
int main() {
  int height;
  printf("Isosceles Triangle of * \n");
  printf("\n");
  printf("Maximum Permissible Height = 40 \n");
  printf("Height of Triangle = ");
  scanf("%d", &height);
  printf("\n");
  if (height > 40) {
    fprintf(stderr, "Height > 40 \nAborting! \n");
    return -1;
  }
  int i, j;
  for (i = 1; i <= height; i++) {
    for (j = height; j > i; j--) {
      printf(" ");
    }
    for (j = 1; j <= 2 * i - 1; j++) {
      printf("*");
    }
    printf("\n");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x28,-0x8(%rbp)
jle    11b6 <main+0x86>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1257 <main+0x127>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1244 <main+0x114>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11f5 <main+0xc5>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11cf <main+0x9f>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     122a <main+0xfa>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11fc <main+0xcc>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <main+0x8d>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ebp
cmp    $0x28,%ebp
jle    11c6 <main+0x76>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1236 <main+0xe6>
test   %ebp,%ebp
jle    122a <main+0xda>
mov    $0x1,%r14d
mov    $0x1,%ebx
jmp    11ed <main+0x9d>
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    %ebx,%ebp
jg     11e0 <main+0x90>
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
mov    0xc(%rsp),%ebp
add    $0x2,%r14d
cmp    %ebp,%ebx
mov    %eax,%ebx
jl     11ed <main+0x9d>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Isosceles Triangle of * \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [34 x i8] c"Maximum Permissible Height = 40 \0A\00"
@.str.3 = [22 x i8] c"Height of Triangle = \00"
@.str.4 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.5 = [25 x i8] c"Height > 40 \0AAborting! \0A\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [2 x i8] c"*\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 40
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %51
16: ; preds = %0
store i32 1, i32* %3
br label %17
17: ; preds = %46, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %49
21: ; preds = %17
%22 = load i32, i32* %2
store i32 %22, i32* %4
br label %23
23: ; preds = %29, %21
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %4
%31 = add nsw i32 %30, -1
store i32 %31, i32* %4
br label %23
32: ; preds = %23
store i32 1, i32* %4
br label %33
33: ; preds = %41, %32
%34 = load i32, i32* %4
%35 = load i32, i32* %3
%36 = mul nsw i32 2, %35
%37 = sub nsw i32 %36, 1
%38 = icmp sle i32 %34, %37
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %41
41: ; preds = %39
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %33
44: ; preds = %33
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %17
49: ; preds = %17
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %51
51: ; preds = %49, %13
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str.3 = [22 x i8] c"Height of Triangle = \00"
@.str.4 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.5 = [25 x i8] c"Height > 40 \0AAborting! \0A\00"
@str = [25 x i8] c"Isosceles Triangle of * \00"
@str.8 = [33 x i8] c"Maximum Permissible Height = 40 \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%8 = call i32 @putchar(i32 10)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 40
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = icmp slt i32 %9, 1
br i1 %12, label %38, label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %40
16: ; preds = %11, %32
%17 = phi i32 [ %37, %32 ], [ 2, %11 ]
%18 = phi i32 [ %35, %32 ], [ %9, %11 ]
%19 = phi i32 [ %34, %32 ], [ 1, %11 ]
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %26
21: ; preds = %16, %21
%22 = phi i32 [ %24, %21 ], [ %18, %16 ]
%23 = call i32 @putchar(i32 32)
%24 = add nsw i32 %22, -1
%25 = icmp sgt i32 %24, %19
br i1 %25, label %21, label %26
26: ; preds = %21, %16
br label %27
27: ; preds = %26, %27
%28 = phi i32 [ %30, %27 ], [ 1, %26 ]
%29 = call i32 @putchar(i32 42)
%30 = add nuw i32 %28, 1
%31 = icmp eq i32 %30, %17
br i1 %31, label %32, label %27
32: ; preds = %27
%33 = call i32 @putchar(i32 10)
%34 = add nuw nsw i32 %19, 1
%35 = load i32, i32* %1
%36 = icmp slt i32 %19, %35
%37 = add i32 %17, 2
br i1 %36, label %16, label %38
38: ; preds = %32, %11
%39 = call i32 @putchar(i32 10)
br label %40
40: ; preds = %38, %13
%41 = phi i32 [ -1, %13 ], [ 0, %38 ]
ret i32 %41
}