#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 N, i, j, k;
  printf("N: ");
  scanf("%d", &N);
  for (i = 1; i <= N; i++) {
    for (j = 0; j < i; j++) {
      printf("!");
    }
    printf("\n");
    if (i == N) {
      for (k = N - 1; k > 0; k--) {
        for (j = 0; j < k; j++) {
          printf("!");
        }
        printf("\n");
      }
    }
  }
  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>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1215 <main+0xf5>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118b <main+0x6b>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1165 <main+0x45>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1202 <main+0xe2>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11fd <main+0xdd>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e3 <main+0xc3>
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bd <main+0x9d>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11ac <main+0x8c>
jmp    1202 <main+0xe2>
jmp    1207 <main+0xe7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11fe <main+0xce>
mov    $0x1,%r15d
xor    %r14d,%r14d
jmp    1180 <main+0x50>
xchg   %ax,%ax
lea    0x1(%r15),%ecx
add    $0x1,%r14d
cmp    %eax,%r15d
mov    %ecx,%r15d
jge    11fe <main+0xce>
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x21,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1190 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    %eax,%r15d
jne    1170 <main+0x40>
cmp    $0x2,%eax
jl     1170 <main+0x40>
mov    %r14d,%ebx
mov    %r15d,%r13d
nopl   (%rax)
lea    -0x1(%r13),%r12d
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x21,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x2,%r13d
mov    %r12d,%r13d
jg     11c0 <main+0x90>
mov    0x4(%rsp),%eax
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"!\00"
@.str.3 = [2 x i8] c"\0A\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)
store i32 1, i32* %3
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %53
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %19, %12
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %13
22: ; preds = %13
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %49
27: ; preds = %22
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 1
store i32 %29, i32* %5
br label %30
30: ; preds = %45, %27
%31 = load i32, i32* %5
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %48
33: ; preds = %30
store i32 0, i32* %4
br label %34
34: ; preds = %40, %33
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %34
43: ; preds = %34
%44 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %43
%46 = load i32, i32* %5
%47 = add nsw i32 %46, -1
store i32 %47, i32* %5
br label %30
48: ; preds = %30
br label %49
49: ; preds = %48, %22
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %8
53: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"N: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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 = icmp slt i32 %5, 1
br i1 %6, label %39, label %7
7: ; preds = %0, %35
%8 = phi i32 [ %37, %35 ], [ 1, %0 ]
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ 0, %7 ], [ %12, %9 ]
%11 = call i32 @putchar(i32 33)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %8
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = call i32 @putchar(i32 10)
%16 = load i32, i32* %1
%17 = icmp eq i32 %8, %16
%18 = icmp sgt i32 %16, 1
%19 = and i1 %17, %18
br i1 %19, label %20, label %35
20: ; preds = %14, %30
%21 = phi i32 [ %23, %30 ], [ %8, %14 ]
%22 = phi i32 [ %24, %30 ], [ %8, %14 ]
%23 = add i32 %21, -1
%24 = add nsw i32 %22, -1
br label %25
25: ; preds = %20, %25
%26 = phi i32 [ %28, %25 ], [ 0, %20 ]
%27 = call i32 @putchar(i32 33)
%28 = add nuw nsw i32 %26, 1
%29 = icmp eq i32 %28, %23
br i1 %29, label %30, label %25
30: ; preds = %25
%31 = call i32 @putchar(i32 10)
%32 = icmp sgt i32 %22, 2
br i1 %32, label %20, label %33
33: ; preds = %30
%34 = load i32, i32* %1
br label %35
35: ; preds = %33, %14
%36 = phi i32 [ %34, %33 ], [ %16, %14 ]
%37 = add nuw nsw i32 %8, 1
%38 = icmp slt i32 %8, %36
br i1 %38, label %7, label %39
39: ; preds = %35, %0
ret i32 0
}