#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*/ putchar(char);
int main() {
  int i, j, a;
  a = 4;
  for (i = 0; i < a; i++) {
    for (j = 0; j <= i; j++)
      printf("*");
    putchar('\n');
  }
  printf("\n");
  for (i = 0; i < a; i++) {
    for (j = 4; j > i; j--)
      printf("*");
    putchar('\n');
  }
  printf("\n");
  for (i = 0; i < a; i++) {
    printf("%*c", i + 1, ' ');
    for (j = 4; j > i; j--)
      printf("*");
    putchar('\n');
  }
  printf("\n");
  for (i = 0; i < a; i++) {
    printf("%*c", a - i, ' ');
    for (j = 0; j <= i; j++)
      printf("*");
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1190 <main+0x70>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1178 <main+0x58>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f8 <main+0xd8>
movl   $0x4,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11e0 <main+0xc0>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11b8 <main+0x98>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x85>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1279 <main+0x159>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xdde(%rip),%rdi
mov    $0x20,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x4,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1261 <main+0x141>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1239 <main+0x119>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120d <main+0xed>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12fa <main+0x1da>
mov    -0x10(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xd5d(%rip),%rdi
mov    $0x20,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12e2 <main+0x1c2>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12ba <main+0x19a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    128e <main+0x16e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdac(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%*c\00"
define i32 @main() {
%1 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%2 = tail call i32 @putchar(i8 signext 10)
%3 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%4 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%5 = tail call i32 @putchar(i8 signext 10)
%6 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%7 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%8 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%9 = tail call i32 @putchar(i8 signext 10)
%10 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%11 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%12 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%13 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%14 = tail call i32 @putchar(i8 signext 10)
%15 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%16 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%17 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%18 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%19 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%20 = tail call i32 @putchar(i8 signext 10)
%21 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%22 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%23 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%24 = tail call i32 @putchar(i8 signext 10)
%25 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%26 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%27 = tail call i32 @putchar(i8 signext 10)
%28 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%29 = tail call i32 @putchar(i8 signext 10)
%30 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 32)
%32 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%33 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%34 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%35 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%36 = tail call i32 @putchar(i8 signext 10)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 32)
%38 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%39 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%40 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%41 = tail call i32 @putchar(i8 signext 10)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 32)
%43 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%44 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%45 = tail call i32 @putchar(i8 signext 10)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 32)
%47 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%48 = tail call i32 @putchar(i8 signext 10)
%49 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 32)
%51 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%52 = tail call i32 @putchar(i8 signext 10)
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 32)
%54 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%55 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%56 = tail call i32 @putchar(i8 signext 10)
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 32)
%58 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%59 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%60 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%61 = tail call i32 @putchar(i8 signext 10)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 32)
%63 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%64 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%65 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%66 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%67 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}