#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i;
  char nome[45];
  char check[45];
  time_t inicio, fim;
  time(&inicio);
  for (i = 1; i <= 254; i++) {
    if (i < 10) {
      sprintf(nome, "./crosssums puzzle_prof/Kakuro_00%d.cfg", i);
      sprintf(check, "chkcs puzzle_prof/Kakuro_00%d.sol; echo $?", i);
    } else {
      if (i < 100) {
        sprintf(nome, "./crosssums puzzle_prof/Kakuro_0%d.cfg", i);
        sprintf(check, "chkcs puzzle_prof/Kakuro_0%d.sol; echo $?", i);
      } else {
        sprintf(nome, "./crosssums puzzle_prof/Kakuro_%d.cfg", i);
        sprintf(check, "chkcs puzzle_prof/Kakuro_%d.sol; echo $?", i);
      }
    }
    system(nome);
    system(check);
    printf(" este foi o Kakuro #%d :)\n", i);
  }
  time(&fim);
  printf("acabou em aproximadamente %.0f segundos\n", difftime(fim, inicio));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x74(%rbp),%rdi
call   1060 <time@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xfe,-0x8(%rbp)
jg     1255 <main+0xf5>
cmpl   $0xa,-0x8(%rbp)
jge    11c4 <main+0x64>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe59(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe6e(%rip),%rsi
call   1070 <sprintf@plt>
jmp    1224 <main+0xc4>
cmpl   $0x64,-0x8(%rbp)
jge    11f9 <main+0x99>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe77(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe8b(%rip),%rsi
call   1070 <sprintf@plt>
jmp    121f <main+0xbf>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe9d(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xeb0(%rip),%rsi
call   1070 <sprintf@plt>
jmp    1224 <main+0xc4>
lea    -0x40(%rbp),%rdi
call   1030 <system@plt>
lea    -0x70(%rbp),%rdi
call   1030 <system@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1182 <main+0x22>
lea    -0x78(%rbp),%rdi
call   1060 <time@plt>
mov    -0x78(%rbp),%edi
mov    -0x74(%rbp),%esi
call   1050 <difftime@plt>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xc(%rsp),%rdi
call   1060 <time@plt>
mov    $0x1,%ebp
movsd  0xe7b(%rip),%xmm0
lea    0xea4(%rip),%r13
lea    0x40(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xf5e(%rip),%r12
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x64,%ebp
lea    0xef2(%rip),%rsi
lea    0xe9a(%rip),%rax
cmovb  %rax,%rsi
lea    0xf06(%rip),%rbx
lea    0xeaf(%rip),%rax
cmovb  %rax,%rbx
cmp    $0xa,%ebp
lea    0xe27(%rip),%rax
cmovb  %rax,%rsi
cmovb  %r13,%rbx
mov    %r14,%rdi
mov    %ebp,%edx
call   1070 <sprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1070 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
call   1030 <system@plt>
mov    %r12,%rdi
movsd  (%rsp),%xmm0
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xdd6(%rip),%xmm0
movsd  %xmm0,(%rsp)
add    $0x1,%ebp
cmp    $0xff,%ebp
jne    11b0 <main+0x50>
lea    0x8(%rsp),%rdi
call   1060 <time@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <difftime@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"./crosssums puzzle_prof/Kakuro_00%d.cfg\00"
@.str.1 = [43 x i8] c"chkcs puzzle_prof/Kakuro_00%d.sol; echo $?\00"
@.str.2 = [39 x i8] c"./crosssums puzzle_prof/Kakuro_0%d.cfg\00"
@.str.3 = [42 x i8] c"chkcs puzzle_prof/Kakuro_0%d.sol; echo $?\00"
@.str.4 = [38 x i8] c"./crosssums puzzle_prof/Kakuro_%d.cfg\00"
@.str.5 = [41 x i8] c"chkcs puzzle_prof/Kakuro_%d.sol; echo $?\00"
@.str.6 = [27 x i8] c" este foi o Kakuro #%d :)\0A\00"
@.str.7 = [41 x i8] c"acabou em aproximadamente %.0f segundos\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [45 x i8]
%4 = alloca [45 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @time(i32* %5)
store i32 1, i32* %2
br label %8
8: ; preds = %47, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 254
br i1 %10, label %11, label %50
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = getelementptr inbounds [45 x i8], [45 x i8]* %3, i64 0, i64 0
%16 = load i32, i32* %2
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [45 x i8], [45 x i8]* %4, i64 0, i64 0
%19 = load i32, i32* %2
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %39
21: ; preds = %11
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 100
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = getelementptr inbounds [45 x i8], [45 x i8]* %3, i64 0, i64 0
%26 = load i32, i32* %2
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [45 x i8], [45 x i8]* %4, i64 0, i64 0
%29 = load i32, i32* %2
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %38
31: ; preds = %21
%32 = getelementptr inbounds [45 x i8], [45 x i8]* %3, i64 0, i64 0
%33 = load i32, i32* %2
%34 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [45 x i8], [45 x i8]* %4, i64 0, i64 0
%36 = load i32, i32* %2
%37 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %31, %24
br label %39
39: ; preds = %38, %14
%40 = getelementptr inbounds [45 x i8], [45 x i8]* %3, i64 0, i64 0
%41 = call i32 @system(i8* %40)
%42 = getelementptr inbounds [45 x i8], [45 x i8]* %4, i64 0, i64 0
%43 = call i32 @system(i8* %42)
%44 = load i32, i32* %2
%45 = sitofp i32 %44 to double
%46 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %45)
br label %47
47: ; preds = %39
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %8
50: ; preds = %8
%51 = call i32 @time(i32* %6)
%52 = load i32, i32* %6
%53 = load i32, i32* %5
%54 = call double @difftime(i32 %52, i32 %53)
%55 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), double %54)
%56 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [40 x i8] c"./crosssums puzzle_prof/Kakuro_00%d.cfg\00"
@.str.1 = [43 x i8] c"chkcs puzzle_prof/Kakuro_00%d.sol; echo $?\00"
@.str.2 = [39 x i8] c"./crosssums puzzle_prof/Kakuro_0%d.cfg\00"
@.str.3 = [42 x i8] c"chkcs puzzle_prof/Kakuro_0%d.sol; echo $?\00"
@.str.4 = [38 x i8] c"./crosssums puzzle_prof/Kakuro_%d.cfg\00"
@.str.5 = [41 x i8] c"chkcs puzzle_prof/Kakuro_%d.sol; echo $?\00"
@.str.6 = [27 x i8] c" este foi o Kakuro #%d :)\0A\00"
@.str.7 = [41 x i8] c"acabou em aproximadamente %.0f segundos\0A\00"
define i32 @main() {
%1 = alloca [45 x i8]
%2 = alloca [45 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [45 x i8], [45 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [45 x i8], [45 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @time(i32* %3)
br label %10
10: ; preds = %0, %10
%11 = phi i32 [ 1, %0 ], [ %24, %10 ]
%12 = icmp ult i32 %11, 10
%13 = icmp ult i32 %11, 100
%14 = select i1 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0)
%15 = select i1 %13, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0)
%16 = select i1 %12, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %14
%17 = select i1 %12, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %15
%18 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) %16, i32 %11)
%19 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) %17, i32 %11)
%20 = call i32 @system(i8* %5)
%21 = call i32 @system(i8* %6)
%22 = sitofp i32 %11 to double
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %22)
%24 = add nuw nsw i32 %11, 1
%25 = icmp eq i32 %24, 255
br i1 %25, label %26, label %10
26: ; preds = %10
%27 = call i32 @time(i32* %4)
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = call double @difftime(i32 %28, i32 %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), double %30)
%32 = call i32 @exit(i32 0)
unreachable
}