#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 main() {
  const int N = 10;
  int p = 0;
  char CH = '$';
  while (p++ < N) {
    int k = p;
    while (k--) {
      printf("%c", CH);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movb   $0x24,-0xd(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xa,%eax
jge    1189 <main+0x79>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1176 <main+0x66>
movsbl -0xd(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114b <main+0x3b>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1131 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0x24,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 0, i32* %3
store i8 36, i8* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = icmp slt i32 %7, 10
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32, i32* %3
store i32 %11, i32* %5
br label %12
12: ; preds = %16, %10
%13 = load i32, i32* %5
%14 = add nsw i32 %13, -1
store i32 %14, i32* %5
%15 = icmp ne i32 %13, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %12
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %6
22: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 36)
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @putchar(i32 36)
%4 = tail call i32 @putchar(i32 36)
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 @putchar(i32 36)
%7 = tail call i32 @putchar(i32 36)
%8 = tail call i32 @putchar(i32 36)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @putchar(i32 36)
%11 = tail call i32 @putchar(i32 36)
%12 = tail call i32 @putchar(i32 36)
%13 = tail call i32 @putchar(i32 36)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @putchar(i32 36)
%16 = tail call i32 @putchar(i32 36)
%17 = tail call i32 @putchar(i32 36)
%18 = tail call i32 @putchar(i32 36)
%19 = tail call i32 @putchar(i32 36)
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 @putchar(i32 36)
%22 = tail call i32 @putchar(i32 36)
%23 = tail call i32 @putchar(i32 36)
%24 = tail call i32 @putchar(i32 36)
%25 = tail call i32 @putchar(i32 36)
%26 = tail call i32 @putchar(i32 36)
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 @putchar(i32 36)
%29 = tail call i32 @putchar(i32 36)
%30 = tail call i32 @putchar(i32 36)
%31 = tail call i32 @putchar(i32 36)
%32 = tail call i32 @putchar(i32 36)
%33 = tail call i32 @putchar(i32 36)
%34 = tail call i32 @putchar(i32 36)
%35 = tail call i32 @putchar(i32 10)
%36 = tail call i32 @putchar(i32 36)
%37 = tail call i32 @putchar(i32 36)
%38 = tail call i32 @putchar(i32 36)
%39 = tail call i32 @putchar(i32 36)
%40 = tail call i32 @putchar(i32 36)
%41 = tail call i32 @putchar(i32 36)
%42 = tail call i32 @putchar(i32 36)
%43 = tail call i32 @putchar(i32 36)
%44 = tail call i32 @putchar(i32 10)
%45 = tail call i32 @putchar(i32 36)
%46 = tail call i32 @putchar(i32 36)
%47 = tail call i32 @putchar(i32 36)
%48 = tail call i32 @putchar(i32 36)
%49 = tail call i32 @putchar(i32 36)
%50 = tail call i32 @putchar(i32 36)
%51 = tail call i32 @putchar(i32 36)
%52 = tail call i32 @putchar(i32 36)
%53 = tail call i32 @putchar(i32 36)
%54 = tail call i32 @putchar(i32 10)
%55 = tail call i32 @putchar(i32 36)
%56 = tail call i32 @putchar(i32 36)
%57 = tail call i32 @putchar(i32 36)
%58 = tail call i32 @putchar(i32 36)
%59 = tail call i32 @putchar(i32 36)
%60 = tail call i32 @putchar(i32 36)
%61 = tail call i32 @putchar(i32 36)
%62 = tail call i32 @putchar(i32 36)
%63 = tail call i32 @putchar(i32 36)
%64 = tail call i32 @putchar(i32 36)
%65 = tail call i32 @putchar(i32 10)
ret i32 0
}