#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 qnt_numbers(int num) {
  int i, j;
  for (i = 1; i <= num; i++) {
    for (j = 1; j <= i; j++) {
      printf("%d", i);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<qnt_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     117c <qnt_numbers+0x6c>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1160 <qnt_numbers+0x50>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <qnt_numbers+0x25>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <qnt_numbers+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qnt_numbers>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    118a <qnt_numbers+0x6a>
mov    %edi,%r14d
add    $0x1,%r14d
mov    $0x1,%ebx
mov    $0x2,%r15d
lea    0xebb(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1160 <qnt_numbers+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
lea    0x1(%r15),%eax
cmp    %r14d,%r15d
mov    %eax,%r15d
jne    1150 <qnt_numbers+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @qnt_numbers(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = add i32 %0, 1
br label %5
5: ; preds = %3, %13
%6 = phi i32 [ 2, %3 ], [ %16, %13 ]
%7 = phi i32 [ 1, %3 ], [ %15, %13 ]
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ 1, %5 ], [ %11, %8 ]
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%11 = add nuw i32 %9, 1
%12 = icmp eq i32 %11, %6
br i1 %12, label %13, label %8
13: ; preds = %8
%14 = tail call i32 @putchar(i32 10)
%15 = add nuw nsw i32 %7, 1
%16 = add nuw i32 %6, 1
%17 = icmp eq i32 %6, %4
br i1 %17, label %18, label %5
18: ; preds = %13, %1
ret i32 undef
}