#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*/ permutate(char *, int *, int *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char result[11];
  int vec[10];
  int seq = 0;
  for (int i = 0; i < 10; i++)
    vec[i] = 0;
  result[10] = '\0';
  permutate(result, vec, &seq, 10);
  printf("If you can trust me, the result you are looking for is %s\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    1161 <main+0x41>
movslq -0x48(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    113d <main+0x1d>
movb   $0x0,-0x5(%rbp)
lea    -0xf(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x44(%rbp),%rdx
mov    $0xa,%ecx
call   1030 <permutate@plt>
lea    -0xf(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movl   $0x0,(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movb   $0x0,0xf(%rsp)
lea    0x5(%rsp),%rbx
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    $0xa,%ecx
call   1030 <permutate@plt>
lea    0xe98(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [59 x i8] c"If you can trust me, the result you are looking for is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
store i8 0, i8* %17
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%20 = call i32 @permutate(i8* %18, i32* %19, i32* %4, i32 10)
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [59 x i8] c"If you can trust me, the result you are looking for is %s\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
%4 = alloca i32
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 10
store i8 0, i8* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @permutate(i8* %5, i32* %8, i32* %4, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}