#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main(void) {
  int h;
  int c;
  int a;
  int b;
  a = -1;
  b = 0;
  printf("h=");
  scanf("%d", &h);
  c = 2 * h - 1;
  while (a < c) {
    a = a + 1;
    printf("\n");
    a = a + 1;
    for (b = 0; b <= a; b++) {
      printf("a");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0xa6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b5 <main+0x95>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118f <main+0x6f>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    115e <main+0x3e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b1 <main+0x81>
lea    (%rax,%rax,1),%r14d
add    $0xffffffff,%r14d
mov    $0xffffffff,%r15d
mov    $0x1,%ebx
nop
test   %ebx,%ebx
mov    $0x0,%ebp
cmovg  %ebx,%ebp
add    $0x1,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%r15d
nopl   0x0(%rax,%rax,1)
mov    $0x61,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x2,%ebx
cmp    %r14d,%r15d
jl     1170 <main+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"h=\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [2 x i8] c"a\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 -1, i32* %3
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = mul nsw i32 2, %7
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %29, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
store i32 0, i32* %4
br label %20
20: ; preds = %26, %14
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %20
29: ; preds = %20
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %10
31: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"h=\00"
@.str.1 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
%7 = add nsw i32 %6, -1
%8 = icmp sgt i32 %5, 0
br i1 %8, label %9, label %24
9: ; preds = %0, %20
%10 = phi i32 [ %23, %20 ], [ 1, %0 ]
%11 = phi i32 [ %14, %20 ], [ -1, %0 ]
%12 = call i32 @llvm.smax.i32(i32 %10, i32 0)
%13 = call i32 @putchar(i32 10)
%14 = add nsw i32 %11, 2
br label %15
15: ; preds = %9, %15
%16 = phi i32 [ %18, %15 ], [ 0, %9 ]
%17 = call i32 @putchar(i32 97)
%18 = add nuw i32 %16, 1
%19 = icmp eq i32 %16, %12
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = call i32 @putchar(i32 10)
%22 = icmp slt i32 %14, %7
%23 = add i32 %10, 2
br i1 %22, label %9, label %24
24: ; preds = %20, %0
ret void
}