#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 *);
int main() {
  int x, y, i, j;
  printf("x: ");
  scanf("%d", &x);
  printf("y: ");
  scanf("%d", &y);
  printf("\n");
  for (i = 1; i <= x; i++)
    printf(" ");
  printf("a\n");
  for (i = 1; i <= x; i++) {
    for (j = 1; j <= x - i; j++) {
      printf(" ");
    }
    printf("a");
    for (j = 1; j <= i; j++) {
      printf("x");
    }
    for (j = 1; j < i; j++) {
      printf("y");
    }
    printf("a");
    printf("\n");
  }
  for (i = 1; i <= y; i++) {
    printf("a");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a0 <main+0x80>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <main+0x5a>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     127d <main+0x15d>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     11f1 <main+0xd1>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0xa6>
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     122a <main+0x10a>
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1204 <main+0xe4>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1257 <main+0x137>
lea    0xdce(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1231 <main+0x111>
lea    0xdb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xda2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b3 <main+0x93>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     12aa <main+0x18a>
lea    0xd77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1284 <main+0x164>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xea9(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x8(%rsp)
jle    11b3 <main+0x73>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     11a0 <main+0x60>
lea    0xe51(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1274 <main+0x134>
mov    $0x1,%ebx
xor    %r14d,%r14d
jmp    1205 <main+0xc5>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%ecx
mov    0x8(%rsp),%eax
add    $0x1,%r14d
cmp    %eax,%ebx
mov    %ecx,%ebx
jge    1274 <main+0x134>
cmp    %ebx,%eax
jle    1227 <main+0xe7>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
sub    %ebx,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1210 <main+0xd0>
mov    $0x61,%edi
call   1030 <putchar@plt>
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x78,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1240 <main+0x100>
mov    %r14d,%ebp
cmp    $0x2,%ebx
jb     11e0 <main+0xa0>
nopw   0x0(%rax,%rax,1)
mov    $0x79,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1260 <main+0x120>
jmp    11e0 <main+0xa0>
cmpl   $0x0,0xc(%rsp)
jle    1293 <main+0x153>
xor    %ebx,%ebx
nopl   (%rax)
mov    $0x61,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1280 <main+0x140>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"x: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"y: \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [3 x i8] c"a\0A\00"
@.str.6 = [2 x i8] c"a\00"
@.str.7 = [2 x i8] c"x\00"
@.str.8 = [2 x i8] c"y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %4
br label %11
11: ; preds = %17, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %11
20: ; preds = %11
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %4
br label %22
22: ; preds = %62, %20
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %65
26: ; preds = %22
store i32 1, i32* %5
br label %27
27: ; preds = %35, %26
%28 = load i32, i32* %5
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = sub nsw i32 %29, %30
%32 = icmp sle i32 %28, %31
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %27
38: ; preds = %27
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %5
br label %40
40: ; preds = %46, %38
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %40
49: ; preds = %40
store i32 1, i32* %5
br label %50
50: ; preds = %56, %49
%51 = load i32, i32* %5
%52 = load i32, i32* %4
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
br label %50
59: ; preds = %50
%60 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%61 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %59
%63 = load i32, i32* %4
%64 = add nsw i32 %63, 1
store i32 %64, i32* %4
br label %22
65: ; preds = %22
store i32 1, i32* %4
br label %66
66: ; preds = %72, %65
%67 = load i32, i32* %4
%68 = load i32, i32* %3
%69 = icmp sle i32 %67, %68
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %72
72: ; preds = %70
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 1
store i32 %74, i32* %4
br label %66
75: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"x: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"y: \00"
@str = [2 x i8] c"a\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @putchar(i32 10)
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 1
br i1 %11, label %18, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %15, %12 ], [ 1, %0 ]
%14 = call i32 @putchar(i32 32)
%15 = add nuw nsw i32 %13, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %13, %16
br i1 %17, label %12, label %18
18: ; preds = %12, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = icmp slt i32 %20, 1
br i1 %21, label %27, label %22
22: ; preds = %18, %51
%23 = phi i32 [ %55, %51 ], [ %20, %18 ]
%24 = phi i32 [ %57, %51 ], [ 2, %18 ]
%25 = phi i32 [ %54, %51 ], [ 1, %18 ]
%26 = icmp sgt i32 %23, %25
br i1 %26, label %30, label %37
27: ; preds = %51, %18
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 1
br i1 %29, label %64, label %58
30: ; preds = %22, %30
%31 = phi i32 [ %33, %30 ], [ 1, %22 ]
%32 = call i32 @putchar(i32 32)
%33 = add nuw nsw i32 %31, 1
%34 = load i32, i32* %1
%35 = sub nsw i32 %34, %25
%36 = icmp slt i32 %31, %35
br i1 %36, label %30, label %37
37: ; preds = %30, %22
%38 = call i32 @putchar(i32 97)
br label %41
39: ; preds = %41
%40 = icmp ugt i32 %25, 1
br i1 %40, label %46, label %51
41: ; preds = %37, %41
%42 = phi i32 [ 1, %37 ], [ %44, %41 ]
%43 = call i32 @putchar(i32 120)
%44 = add nuw i32 %42, 1
%45 = icmp eq i32 %44, %24
br i1 %45, label %39, label %41
46: ; preds = %39, %46
%47 = phi i32 [ %49, %46 ], [ 1, %39 ]
%48 = call i32 @putchar(i32 121)
%49 = add nuw nsw i32 %47, 1
%50 = icmp eq i32 %49, %25
br i1 %50, label %51, label %46
51: ; preds = %46, %39
%52 = call i32 @putchar(i32 97)
%53 = call i32 @putchar(i32 10)
%54 = add nuw nsw i32 %25, 1
%55 = load i32, i32* %1
%56 = icmp slt i32 %25, %55
%57 = add nuw i32 %24, 1
br i1 %56, label %22, label %27
58: ; preds = %27, %58
%59 = phi i32 [ %61, %58 ], [ 1, %27 ]
%60 = call i32 @putchar(i32 97)
%61 = add nuw nsw i32 %59, 1
%62 = load i32, i32* %2
%63 = icmp slt i32 %59, %62
br i1 %63, label %58, label %64
64: ; preds = %58, %27
ret i32 0
}