#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 *, ...);
void print_permutation(int n) {
  int i = 1, j = 1;
  for (i = 1; i <= 9; i++) {
    if (i <= 9) {
      printf("%d  ", i);
    }
    int num = 0;
    for (j = i; j <= 9; j++) {
      num = i * 10 + j;
      if (num <= n) {
        printf("%d  ", num);
      }
    }
    num = 0;
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_permutation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     11c9 <print_permutation+0xb9>
cmpl   $0x9,-0x8(%rbp)
jg     1155 <print_permutation+0x45>
mov    -0x8(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     11a6 <print_permutation+0x96>
imul   $0xa,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1193 <print_permutation+0x83>
mov    -0x10(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <print_permutation+0x88>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <print_permutation+0x52>
movl   $0x0,-0x10(%rbp)
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <print_permutation+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_permutation>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xed3(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xb,%ebp
jmp    1158 <print_permutation+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmp    $0x14,%ebp
je     116a <print_permutation+0x4a>
cmp    %ebx,%ebp
jg     1150 <print_permutation+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <print_permutation+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe85(%rip),%r14
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x16,%ebp
jmp    11a8 <print_permutation+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x1e,%ebp
je     11ba <print_permutation+0x9a>
cmp    %ebx,%ebp
jg     11a0 <print_permutation+0x80>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a0 <print_permutation+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe35(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x21,%ebp
jmp    11f8 <print_permutation+0xd8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x28,%ebp
je     120a <print_permutation+0xea>
cmp    %ebx,%ebp
jg     11f0 <print_permutation+0xd0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f0 <print_permutation+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xde5(%rip),%r14
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2c,%ebp
jmp    1248 <print_permutation+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x32,%ebp
je     125a <print_permutation+0x13a>
cmp    %ebx,%ebp
jg     1240 <print_permutation+0x120>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1240 <print_permutation+0x120>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd95(%rip),%r14
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x37,%ebp
jmp    1298 <print_permutation+0x178>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x3c,%ebp
je     12aa <print_permutation+0x18a>
cmp    %ebx,%ebp
jg     1290 <print_permutation+0x170>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1290 <print_permutation+0x170>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd45(%rip),%r14
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x42,%ebp
jmp    12e8 <print_permutation+0x1c8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x46,%ebp
je     12fa <print_permutation+0x1da>
cmp    %ebx,%ebp
jg     12e0 <print_permutation+0x1c0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12e0 <print_permutation+0x1c0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcf5(%rip),%r14
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4d,%ebp
jmp    1338 <print_permutation+0x218>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x50,%ebp
je     134a <print_permutation+0x22a>
cmp    %ebx,%ebp
jg     1330 <print_permutation+0x210>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1330 <print_permutation+0x210>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xca5(%rip),%r14
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x58,%ebp
jmp    1388 <print_permutation+0x268>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x5a,%ebp
je     139a <print_permutation+0x27a>
cmp    %ebx,%ebp
jg     1380 <print_permutation+0x260>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1380 <print_permutation+0x260>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc55(%rip),%r14
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x63,%ebp
jmp    13d8 <print_permutation+0x2b8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x64,%ebp
je     13ea <print_permutation+0x2ca>
cmp    %ebx,%ebp
jg     13d0 <print_permutation+0x2b0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13d0 <print_permutation+0x2b0>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d \00"
define void @print_permutation(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
br label %3
3: ; preds = %1, %9
%4 = phi i32 [ 1, %1 ], [ %10, %9 ]
%5 = add nuw nsw i32 %4, 10
%6 = icmp sgt i32 %5, %0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %3, %7
%10 = add nuw nsw i32 %4, 1
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %3
12: ; preds = %9
%13 = tail call i32 @putchar(i32 10)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
br label %15
15: ; preds = %21, %12
%16 = phi i32 [ 2, %12 ], [ %22, %21 ]
%17 = add nuw nsw i32 %16, 20
%18 = icmp sgt i32 %17, %0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %21
21: ; preds = %19, %15
%22 = add nuw nsw i32 %16, 1
%23 = icmp eq i32 %22, 10
br i1 %23, label %24, label %15
24: ; preds = %21
%25 = tail call i32 @putchar(i32 10)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
br label %27
27: ; preds = %33, %24
%28 = phi i32 [ 3, %24 ], [ %34, %33 ]
%29 = add nuw nsw i32 %28, 30
%30 = icmp sgt i32 %29, %0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %33
33: ; preds = %31, %27
%34 = add nuw nsw i32 %28, 1
%35 = icmp eq i32 %34, 10
br i1 %35, label %36, label %27
36: ; preds = %33
%37 = tail call i32 @putchar(i32 10)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
br label %39
39: ; preds = %45, %36
%40 = phi i32 [ 4, %36 ], [ %46, %45 ]
%41 = add nuw nsw i32 %40, 40
%42 = icmp sgt i32 %41, %0
br i1 %42, label %45, label %43
43: ; preds = %39
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %45
45: ; preds = %43, %39
%46 = add nuw nsw i32 %40, 1
%47 = icmp eq i32 %46, 10
br i1 %47, label %48, label %39
48: ; preds = %45
%49 = tail call i32 @putchar(i32 10)
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
br label %51
51: ; preds = %57, %48
%52 = phi i32 [ 5, %48 ], [ %58, %57 ]
%53 = add nuw nsw i32 %52, 50
%54 = icmp sgt i32 %53, %0
br i1 %54, label %57, label %55
55: ; preds = %51
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %53)
br label %57
57: ; preds = %55, %51
%58 = add nuw nsw i32 %52, 1
%59 = icmp eq i32 %58, 10
br i1 %59, label %60, label %51
60: ; preds = %57
%61 = tail call i32 @putchar(i32 10)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 6)
br label %63
63: ; preds = %69, %60
%64 = phi i32 [ 6, %60 ], [ %70, %69 ]
%65 = add nuw nsw i32 %64, 60
%66 = icmp sgt i32 %65, %0
br i1 %66, label %69, label %67
67: ; preds = %63
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %65)
br label %69
69: ; preds = %67, %63
%70 = add nuw nsw i32 %64, 1
%71 = icmp eq i32 %70, 10
br i1 %71, label %72, label %63
72: ; preds = %69
%73 = tail call i32 @putchar(i32 10)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 7)
br label %75
75: ; preds = %81, %72
%76 = phi i32 [ 7, %72 ], [ %82, %81 ]
%77 = add nuw nsw i32 %76, 70
%78 = icmp sgt i32 %77, %0
br i1 %78, label %81, label %79
79: ; preds = %75
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %77)
br label %81
81: ; preds = %79, %75
%82 = add nuw nsw i32 %76, 1
%83 = icmp eq i32 %82, 10
br i1 %83, label %84, label %75
84: ; preds = %81
%85 = tail call i32 @putchar(i32 10)
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 8)
br label %87
87: ; preds = %93, %84
%88 = phi i32 [ 8, %84 ], [ %94, %93 ]
%89 = add nuw nsw i32 %88, 80
%90 = icmp sgt i32 %89, %0
br i1 %90, label %93, label %91
91: ; preds = %87
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %89)
br label %93
93: ; preds = %91, %87
%94 = add nuw nsw i32 %88, 1
%95 = icmp eq i32 %94, 10
br i1 %95, label %96, label %87
96: ; preds = %93
%97 = tail call i32 @putchar(i32 10)
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9)
br label %99
99: ; preds = %105, %96
%100 = phi i32 [ 9, %96 ], [ %106, %105 ]
%101 = add nuw nsw i32 %100, 90
%102 = icmp sgt i32 %101, %0
br i1 %102, label %105, label %103
103: ; preds = %99
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %101)
br label %105
105: ; preds = %103, %99
%106 = add nuw nsw i32 %100, 1
%107 = icmp eq i32 %106, 10
br i1 %107, label %108, label %99
108: ; preds = %105
%109 = tail call i32 @putchar(i32 10)
ret void
}