#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*/ file2array(char *, int *);
int pow(int, int);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  char filename[15];
  int i;
  for (i = 1; i < 2; i++) {
    int setlen = pow(10, i);
    int set[setlen];
    sprintf(filename, "sets/p%d.txt", i);
    printf("%s: %d elements\n", filename, setlen);
    file2array(filename, set);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    11df <main+0x9f>
mov    -0x18(%rbp),%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    -0x13(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe5b(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x13(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    -0x13(%rbp),%rdi
call   1050 <file2array@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <main+0x16>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%r14d
mov    %rsp,%r12
mov    %eax,%eax
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe7e(%rip),%rsi
lea    -0x2f(%rbp),%r15
mov    %r15,%rdi
mov    $0x1,%edx
call   1060 <sprintf@plt>
lea    0xe73(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <file2array@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"sets/p%d.txt\00"
@.str.1 = [17 x i8] c"%s: %d elements\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
store i32 1, i32* %3
br label %7
7: ; preds = %26, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %29
10: ; preds = %7
%11 = load i32, i32* %3
%12 = call i32 @pow(i32 10, i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %5
%16 = alloca i32, i64 %14
store i64 %14, i64* %6
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %21)
%23 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%24 = call i32 @file2array(i8* %23, i32* %16)
%25 = load i8*, i8** %5
br label %26
26: ; preds = %10
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %7
29: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"sets/p%d.txt\00"
@.str.1 = [17 x i8] c"%s: %d elements\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @pow(i32 10, i32 1)
%4 = zext i32 %3 to i64
%5 = tail call i8* @llvm.stacksave()
%6 = alloca i32, i64 %4
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %3)
%9 = call i32 @file2array(i8* %2, i32* %6)
ret i32 0
}