#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 fac(int);
int /*<<< orphan*/ printf(char *, int, int);
int uncantor(int *B, int n, int k) {
  int used[100] = {};
  int i, j, t, l;
  for (i = 1; i <= n; i++) {
    t = k / fac(n - i);
    k = k % fac(n - i);
    for (j = 1, l = 0; l <= t; j++) {
      if (!used[j])
        l++;
    }
    printf("The two number is %d ,%d\n", j, i);
    j--;
    used[j] = 1;
    B[i - 1] = j;
  }
  return 0;
}


x86 assembly (clang, -O0):
<uncantor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1050 <memset@plt>
movl   $0x1,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1287 <uncantor+0x157>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1b8(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x1a4(%rbp),%edi
call   1030 <fac@plt>
mov    %eax,%ecx
mov    -0x1b8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x1ac(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x1a4(%rbp),%edi
call   1030 <fac@plt>
mov    %eax,%ecx
mov    -0x1b4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x1a8(%rbp)
movl   $0x0,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%eax
cmp    -0x1ac(%rbp),%eax
jg     1221 <uncantor+0xf1>
movslq -0x1a8(%rbp),%rax
cmpl   $0x0,-0x1a0(%rbp,%rax,4)
jne    1208 <uncantor+0xd8>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    120d <uncantor+0xdd>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    11d2 <uncantor+0xa2>
mov    -0x1a8(%rbp),%esi
mov    -0x1a4(%rbp),%edx
lea    0xdcc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1a8(%rbp)
movslq -0x1a8(%rbp),%rax
movl   $0x1,-0x1a0(%rbp,%rax,4)
mov    -0x1a8(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x1a4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1162 <uncantor+0x32>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uncantor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
mov    %edx,%r13d
mov    %esi,%r15d
mov    %rdi,0x8(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1050 <memset@plt>
test   %r15d,%r15d
jle    1203 <uncantor+0xd3>
lea    0x1(%r15),%r14d
mov    $0x1,%ebx
jmp    11b5 <uncantor+0x85>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%ebp
lea    0xe74(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
movslq %ebp,%rax
add    $0xffffffff,%ebp
movl   $0x1,0xc(%rsp,%rax,4)
mov    0x8(%rsp),%rax
mov    %ebp,-0x4(%rax,%rbx,4)
add    $0x1,%rbx
cmp    %r14,%rbx
je     1203 <uncantor+0xd3>
mov    %r15d,%ebp
sub    %ebx,%ebp
mov    %ebp,%edi
call   1030 <fac@plt>
mov    %eax,%ecx
mov    %r13d,%eax
cltd
idiv   %ecx
mov    %eax,%r12d
mov    %ebp,%edi
call   1030 <fac@plt>
mov    %eax,%ecx
mov    %r13d,%eax
cltd
idiv   %ecx
mov    %edx,%r13d
test   %r12d,%r12d
js     1180 <uncantor+0x50>
xor    %eax,%eax
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
cmpl   $0x1,0x10(%rsp,%rbp,4)
adc    $0x0,%eax
add    $0x1,%rbp
cmp    %r12d,%eax
jle    11f0 <uncantor+0xc0>
jmp    1185 <uncantor+0x55>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"The two number is %d ,%d\0A\00"
define i32 @uncantor(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = bitcast [100 x i32]* %7 to i8*
store i32 1, i32* %8
br label %13
13: ; preds = %62, %3
%14 = load i32, i32* %8
%15 = load i32, i32* %5
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %65
17: ; preds = %13
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = load i32, i32* %8
%21 = sub nsw i32 %19, %20
%22 = call i32 @fac(i32 %21)
%23 = sdiv i32 %18, %22
store i32 %23, i32* %10
%24 = load i32, i32* %6
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = sub nsw i32 %25, %26
%28 = call i32 @fac(i32 %27)
%29 = srem i32 %24, %28
store i32 %29, i32* %6
store i32 1, i32* %9
store i32 0, i32* %11
br label %30
30: ; preds = %44, %17
%31 = load i32, i32* %11
%32 = load i32, i32* %10
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %47
34: ; preds = %30
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %34
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
br label %43
43: ; preds = %40, %34
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %30
47: ; preds = %30
%48 = load i32, i32* %9
%49 = load i32, i32* %8
%50 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %48, i32 %49)
%51 = load i32, i32* %9
%52 = add nsw i32 %51, -1
store i32 %52, i32* %9
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %54
store i32 1, i32* %55
%56 = load i32, i32* %9
%57 = load i32*, i32** %4
%58 = load i32, i32* %8
%59 = sub nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %57, i64 %60
store i32 %56, i32* %61
br label %62
62: ; preds = %47
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
br label %13
65: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"The two number is %d ,%d\0A\00"
define i32 @uncantor(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = alloca [100 x i32]
%5 = bitcast [100 x i32]* %4 to i8*
%6 = icmp slt i32 %1, 1
br i1 %6, label %43, label %7
7: ; preds = %3
%8 = add nuw i32 %1, 1
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %7, %32
%11 = phi i64 [ 1, %7 ], [ %41, %32 ]
%12 = phi i32 [ %2, %7 ], [ %18, %32 ]
%13 = trunc i64 %11 to i32
%14 = sub i32 %1, %13
%15 = tail call i32 @fac(i32 %14)
%16 = sdiv i32 %12, %15
%17 = tail call i32 @fac(i32 %14)
%18 = srem i32 %12, %17
%19 = icmp slt i32 %16, 0
br i1 %19, label %32, label %20
20: ; preds = %10, %20
%21 = phi i64 [ %28, %20 ], [ 1, %10 ]
%22 = phi i32 [ %27, %20 ], [ 0, %10 ]
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %21
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = add nuw nsw i32 %22, %26
%28 = add nuw i64 %21, 1
%29 = icmp sgt i32 %27, %16
br i1 %29, label %30, label %20
30: ; preds = %20
%31 = trunc i64 %28 to i32
br label %32
32: ; preds = %30, %10
%33 = phi i32 [ 1, %10 ], [ %31, %30 ]
%34 = trunc i64 %11 to i32
%35 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34)
%36 = add nsw i32 %33, -1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %37
store i32 1, i32* %38
%39 = add nsw i64 %11, -1
%40 = getelementptr inbounds i32, i32* %0, i64 %39
store i32 %36, i32* %40
%41 = add nuw nsw i64 %11, 1
%42 = icmp eq i64 %41, %9
br i1 %42, label %43, label %10
43: ; preds = %32, %3
ret i32 0
}