int main(int argc, char *argv[]) {
  int i = 0;
  int j = 0;
  printf("%d\n", argv[1]);
  for (i = 0; i < (int)argv[1]; i++) {
    for (j = 0; j < i; j++) {
      printf("* ");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
cmp    %ecx,%eax
jge    11af <main+0x9f>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1193 <main+0x83>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116b <main+0x5b>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <main+0x41>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x8(%rsi),%rsi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x8(%r14)
jle    1181 <main+0x61>
lea    0xeba(%rip),%rbx
xor    %r15d,%r15d
jmp    1164 <main+0x44>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    0x8(%r14),%r15d
jge    1181 <main+0x61>
test   %r15d,%r15d
je     1150 <main+0x30>
mov    %r15d,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1170 <main+0x50>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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