#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*/ criar_ficheiro(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  int i;
  char nome[20];
  for (i = 1; i <= 254; i++) {
    if (i < 10) {
      sprintf(nome, "Kakuro_00%d.sol", i);
    } else {
      if (i < 100) {
        sprintf(nome, "Kakuro_0%d.sol", i);
      } else {
        sprintf(nome, "Kakuro_%d.sol", i);
      }
    }
    criar_ficheiro(nome);
  }
  printf("done :)\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xfe,-0x8(%rbp)
jg     11d6 <main+0x96>
cmpl   $0xa,-0x8(%rbp)
jge    1185 <main+0x45>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe85(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11bf <main+0x7f>
cmpl   $0x64,-0x8(%rbp)
jge    11a7 <main+0x67>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe73(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11ba <main+0x7a>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe6a(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11bf <main+0x7f>
lea    -0x20(%rbp),%rdi
call   1040 <criar_ficheiro@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    $0x1,%ebx
lea    0xeb7(%rip),%r15
lea    0xebf(%rip),%r12
lea    0xe99(%rip),%r13
mov    %rsp,%r14
nopw   0x0(%rax,%rax,1)
cmp    $0x64,%ebx
mov    %r12,%rsi
cmovb  %r15,%rsi
cmp    $0xa,%ebx
cmovb  %r13,%rsi
mov    %r14,%rdi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1040 <criar_ficheiro@plt>
add    $0x1,%ebx
cmp    $0xff,%ebx
jne    1170 <main+0x30>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Kakuro_00%d.sol\00"
@.str.1 = [15 x i8] c"Kakuro_0%d.sol\00"
@.str.2 = [14 x i8] c"Kakuro_%d.sol\00"
@.str.3 = [9 x i8] c"done :)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 0, i32* %1
store i32 1, i32* %2
br label %4
4: ; preds = %29, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 254
br i1 %6, label %7, label %32
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %26
14: ; preds = %7
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 100
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%19 = load i32, i32* %2
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %25
21: ; preds = %14
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%23 = load i32, i32* %2
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21, %17
br label %26
26: ; preds = %25, %10
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%28 = call i32 @criar_ficheiro(i8* %27)
br label %29
29: ; preds = %26
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %4
32: ; preds = %4
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [16 x i8] c"Kakuro_00%d.sol\00"
@.str.1 = [15 x i8] c"Kakuro_0%d.sol\00"
@.str.2 = [14 x i8] c"Kakuro_%d.sol\00"
@str = [8 x i8] c"done :)\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 1, %0 ], [ %11, %3 ]
%5 = icmp ult i32 %4, 10
%6 = icmp ult i32 %4, 100
%7 = select i1 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0)
%8 = select i1 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) %8, i32 %4)
%10 = call i32 @criar_ficheiro(i8* %2)
%11 = add nuw nsw i32 %4, 1
%12 = icmp eq i32 %11, 255
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}