#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*/ free(char *);
scalar_t__ increseNumber(char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printNumber(char *);
int /*<<< orphan*/ printf(char *);
void print1ToMaxOfNDigits_string(int n) {
  if (n <= 0) {
    return;
  }
  char *number = (char *)malloc((n + 1) * sizeof(char));
  memset(number, '0', n);
  number[n] = '\0';
  while (increseNumber(number, n)) {
    printNumber(number);
  }
  printf("\n");
  free(number);
}


x86 assembly (clang, -O0):
<print1ToMaxOfNDigits_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     117a <print1ToMaxOfNDigits_string+0x1a>
jmp    11e7 <print1ToMaxOfNDigits_string+0x87>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x30,%esi
call   1050 <memset@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1080 <increseNumber@plt>
cmp    $0x0,%rax
je     11d2 <print1ToMaxOfNDigits_string+0x72>
mov    -0x10(%rbp),%rdi
call   1060 <printNumber@plt>
jmp    11ae <print1ToMaxOfNDigits_string+0x4e>
lea    0xe27(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print1ToMaxOfNDigits_string>:
test   %edi,%edi
jle    11c3 <print1ToMaxOfNDigits_string+0x63>
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
lea    0x1(%r14),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x30,%esi
mov    %r14d,%edx
call   1050 <memset@plt>
mov    %r14d,%eax
movb   $0x0,(%rbx,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14d,%esi
call   1080 <increseNumber@plt>
test   %rax,%rax
je     11aa <print1ToMaxOfNDigits_string+0x4a>
mov    %rbx,%rdi
call   1060 <printNumber@plt>
jmp    1190 <print1ToMaxOfNDigits_string+0x30>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @print1ToMaxOfNDigits_string(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = add nuw nsw i32 %0, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @memset(i8* %6, i32 48, i32 %0)
%8 = zext i32 %0 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 0, i8* %9
%10 = tail call i64 @increseNumber(i8* %6, i32 %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %3, %12
%13 = tail call i32 @printNumber(i8* %6)
%14 = tail call i64 @increseNumber(i8* %6, i32 %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %12
16: ; preds = %12, %3
%17 = tail call i32 @putchar(i32 10)
%18 = tail call i32 @free(i8* %6)
br label %19
19: ; preds = %1, %16
ret void
}