#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 */
struct timeval {
  int tv_sec;
  int tv_usec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int append_str(char **, int, char *);
char *basename(char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ free(char *);
char *from_str(char *, int **);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ load_bar(int, int, int, int);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
char *read_entire_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ solve(int **);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ to_str(int **, char *);
int main(int argc, char const *argv[]) {
  FILE *f = fopen(argv[1], "r");
  if (!f) {
    printf("Could not open file %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  int progress = 0;
  if (argc > 2 && strcmp(argv[2], "-p")) {
    progress = 1;
  }
  char *contents = read_entire_file(f);
  fclose(f);
  struct timeval before;
  gettimeofday(&before, NULL);
  int result_size = 1024;
  char *result = malloc(sizeof(char) * result_size);
  strcpy(result, "");
  char *ptr = contents;
  int total_sudokus = strlen(contents) / (9 * 9);
  int sudokus_solved = 0;
  char solved[256];
  do {
    int sudoku[9][9];
    ptr = from_str(ptr, sudoku);
    solve(sudoku);
    to_str(sudoku, solved);
    result_size = append_str(&result, result_size, solved);
    if (progress) {
      load_bar(++sudokus_solved, total_sudokus, 100, 100);
    }
  } while (*ptr);
  free(contents);
  struct timeval after;
  gettimeofday(&after, NULL);
  long duration = ((after.tv_sec * 1000000 + after.tv_usec) -
                   (before.tv_sec * 1000000 + before.tv_usec)) /
                  1000;
  char output_name[64];
  char *filename = basename(argv[1]);
  sprintf(output_name, "solved_%s", filename);
  FILE *output = fopen(output_name, "w");
  if (!output) {
    printf("Could not open file %s\n", output_name);
    exit(EXIT_FAILURE);
  }
  fprintf(output, "%s", result);
  free(result);
  fclose(output);
  printf("-- Elapsed time: %d ms\n", duration);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x300,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda8(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1290 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    12c6 <main+0x96>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd6a(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     12c6 <main+0x96>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1110 <read_entire_file@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <fclose@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <gettimeofday@plt>
movl   $0x400,-0x34(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1100 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xd0b(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
call   1090 <strlen@plt>
mov    $0x51,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x2a0(%rbp),%rsi
call   10f0 <from_str@plt>
mov    %rax,-0x48(%rbp)
lea    -0x2a0(%rbp),%rdi
call   1030 <solve@plt>
lea    -0x2a0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1080 <to_str@plt>
mov    -0x34(%rbp),%esi
lea    -0x150(%rbp),%rdx
lea    -0x40(%rbp),%rdi
call   1060 <append_str@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     13a1 <main+0x171>
mov    -0x50(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x50(%rbp)
mov    -0x4c(%rbp),%esi
mov    $0x64,%ecx
mov    %ecx,%edx
call   1150 <load_bar@plt>
jmp    13a6 <main+0x176>
mov    -0x48(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1336 <main+0x106>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
lea    -0x2a8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <gettimeofday@plt>
imul   $0xf4240,-0x2a8(%rbp),%eax
add    -0x2a4(%rbp),%eax
imul   $0xf4240,-0x30(%rbp),%ecx
add    -0x2c(%rbp),%ecx
sub    %ecx,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x2b0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <basename@plt>
mov    %rax,-0x2f8(%rbp)
lea    -0x2f0(%rbp),%rdi
mov    -0x2f8(%rbp),%rdx
lea    0xbfb(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x2f0(%rbp),%rdi
lea    0xbf2(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x300(%rbp)
cmpq   $0x0,-0x300(%rbp)
jne    1472 <main+0x242>
lea    -0x2f0(%rbp),%rsi
lea    0xba5(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    0x2b75(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x300(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xba0(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x300(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x2b0(%rbp),%rsi
lea    0xb7d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
xor    %eax,%eax
add    $0x300,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x288,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
mov    0x8(%rsi),%rdi
lea    0xdae(%rip),%rsi
call   1120 <fopen@plt>
test   %rax,%rax
je     1436 <main+0x206>
mov    %rax,%rbx
mov    $0x1,%r12b
cmp    $0x3,%r14d
jl     1283 <main+0x53>
mov    0x10(%rbp),%rdi
lea    0xda3(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
sete   %r12b
mov    %rbp,0x20(%rsp)
mov    %rbx,%rdi
call   1110 <read_entire_file@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1070 <fclose@plt>
xor    %r13d,%r13d
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   10b0 <gettimeofday@plt>
mov    $0x400,%ebp
mov    $0x400,%edi
call   1100 <malloc@plt>
mov    %rax,(%rsp)
lea    0xd55(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    %r15,%rdi
call   1090 <strlen@plt>
cltq
imul   $0x1948b0fd,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x23,%rcx
add    %eax,%ecx
mov    %rcx,0x28(%rsp)
lea    0x30(%rsp),%rbx
lea    0x180(%rsp),%r14
mov    %r15,0x18(%rsp)
jmp    1316 <main+0xe6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x0,(%r15)
je     1368 <main+0x138>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10f0 <from_str@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <solve@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <to_str@plt>
mov    %rsp,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1060 <append_str@plt>
mov    %eax,%ebp
test   %r12b,%r12b
jne    1310 <main+0xe0>
add    $0x1,%r13d
mov    %r13d,%edi
mov    0x28(%rsp),%rsi
mov    $0x64,%edx
mov    $0x64,%ecx
call   1150 <load_bar@plt>
jmp    1310 <main+0xe0>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   10b0 <gettimeofday@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%ebp
mov    0x10(%rsp),%r12d
mov    0x14(%rsp),%r15d
mov    0x20(%rsp),%rax
mov    0x8(%rax),%rdi
call   10e0 <basename@plt>
lea    0xc78(%rip),%rsi
lea    0x30(%rsp),%r14
mov    %r14,%rdi
mov    %rax,%rdx
call   1130 <sprintf@plt>
lea    0xc6b(%rip),%rsi
mov    %r14,%rdi
call   1120 <fopen@plt>
test   %rax,%rax
je     1443 <main+0x213>
mov    %rax,%r14
sub    %r12d,%ebx
imul   $0xf4240,%ebx,%eax
sub    %r15d,%ebp
add    %eax,%ebp
movslq %ebp,%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
movslq %eax,%rbp
mov    (%rsp),%rdi
mov    %r14,%rsi
call   10c0 <fputs@plt>
mov    (%rsp),%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
lea    0xc11(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %eax,%eax
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbp),%rsi
lea    0xbc1(%rip),%rdi
jmp    144f <main+0x21f>
lea    0xbb8(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x2b83(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [24 x i8] c"Could not open file %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [10 x i8] c"solved_%s\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [24 x i8] c"-- Elapsed time: %d ms\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca %struct.timeval
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca [256 x i8]
%16 = alloca [9 x [9 x i32]]
%17 = alloca %struct.timeval
%18 = alloca i64
%19 = alloca [64 x i8]
%20 = alloca i8*
%21 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp ne i32* %26, null
br i1 %27, label %35, label %28
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %2
store i32 0, i32* %7
%36 = load i32, i32* %4
%37 = icmp sgt i32 %36, 2
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 1, i32* %7
br label %45
45: ; preds = %44, %38, %35
%46 = load i32*, i32** %6
%47 = call i8* @read_entire_file(i32* %46)
store i8* %47, i8** %8
%48 = load i32*, i32** %6
%49 = call i32 @fclose(i32* %48)
%50 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
store i32 1024, i32* %10
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = mul i64 1, %52
%54 = trunc i64 %53 to i32
%55 = call i8* @malloc(i32 %54)
store i8* %55, i8** %11
%56 = load i8*, i8** %11
%57 = call i32 @strcpy(i8* %56, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%58 = load i8*, i8** %8
store i8* %58, i8** %12
%59 = load i8*, i8** %8
%60 = call i32 @strlen(i8* %59)
%61 = sdiv i32 %60, 81
store i32 %61, i32* %13
store i32 0, i32* %14
br label %62
62: ; preds = %85, %45
%63 = load i8*, i8** %12
%64 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %16, i64 0, i64 0
%65 = bitcast [9 x i32]* %64 to i32**
%66 = call i8* @from_str(i8* %63, i32** %65)
store i8* %66, i8** %12
%67 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %16, i64 0, i64 0
%68 = bitcast [9 x i32]* %67 to i32**
%69 = call i32 @solve(i32** %68)
%70 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %16, i64 0, i64 0
%71 = bitcast [9 x i32]* %70 to i32**
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%73 = call i32 @to_str(i32** %71, i8* %72)
%74 = load i32, i32* %10
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%76 = call i32 @append_str(i8** %11, i32 %74, i8* %75)
store i32 %76, i32* %10
%77 = load i32, i32* %7
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %62
%80 = load i32, i32* %14
%81 = add nsw i32 %80, 1
store i32 %81, i32* %14
%82 = load i32, i32* %13
%83 = call i32 @load_bar(i32 %81, i32 %82, i32 100, i32 100)
br label %84
84: ; preds = %79, %62
br label %85
85: ; preds = %84
%86 = load i8*, i8** %12
%87 = load i8, i8* %86
%88 = icmp ne i8 %87, 0
br i1 %88, label %62, label %89
89: ; preds = %85
%90 = load i8*, i8** %8
%91 = call i32 @free(i8* %90)
%92 = call i32 @gettimeofday(%struct.timeval* %17, i32* null)
%93 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%94 = load i32, i32* %93
%95 = mul nsw i32 %94, 1000000
%96 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%97 = load i32, i32* %96
%98 = add nsw i32 %95, %97
%99 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%100 = load i32, i32* %99
%101 = mul nsw i32 %100, 1000000
%102 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%103 = load i32, i32* %102
%104 = add nsw i32 %101, %103
%105 = sub nsw i32 %98, %104
%106 = sdiv i32 %105, 1000
%107 = sext i32 %106 to i64
store i64 %107, i64* %18
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 1
%110 = load i8*, i8** %109
%111 = call i8* @basename(i8* %110)
store i8* %111, i8** %20
%112 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 0
%113 = load i8*, i8** %20
%114 = call i32 @sprintf(i8* %112, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %113)
%115 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 0
%116 = call i32* @fopen(i8* %115, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %116, i32** %21
%117 = load i32*, i32** %21
%118 = icmp ne i32* %117, null
br i1 %118, label %124, label %119
119: ; preds = %89
%120 = getelementptr inbounds [64 x i8], [64 x i8]* %19, i64 0, i64 0
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %120)
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %89
%125 = load i32*, i32** %21
%126 = load i8*, i8** %11
%127 = call i32 @fprintf(i32* %125, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %126)
%128 = load i8*, i8** %11
%129 = call i32 @free(i8* %128)
%130 = load i32*, i32** %21
%131 = call i32 @fclose(i32* %130)
%132 = load i64, i64* %18
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i64 %132)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [24 x i8] c"Could not open file %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"-p\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [10 x i8] c"solved_%s\00"
@.str.5 = [2 x i8] c"w\00"
@.str.7 = [24 x i8] c"-- Elapsed time: %d ms\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca [9 x [9 x i32]]
%7 = alloca %struct.timeval
%8 = alloca [64 x i8]
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8*, i8** %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = icmp sgt i32 %0, 2
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br label %25
25: ; preds = %20, %18
%26 = phi i1 [ true, %18 ], [ %24, %20 ]
%27 = tail call i8* @read_entire_file(i32* %11)
%28 = tail call i32 @fclose(i32* %11)
%29 = bitcast %struct.timeval* %3 to i8*
%30 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%31 = bitcast i8** %4 to i8*
%32 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
store i8* %32, i8** %4
%33 = tail call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%34 = tail call i32 @strlen(i8* %27)
%35 = sdiv i32 %34, 81
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%37 = bitcast [9 x [9 x i32]]* %6 to i8*
%38 = bitcast [9 x [9 x i32]]* %6 to i32**
br label %39
39: ; preds = %50, %25
%40 = phi i32 [ 0, %25 ], [ %51, %50 ]
%41 = phi i8* [ %27, %25 ], [ %43, %50 ]
%42 = phi i32 [ 1024, %25 ], [ %46, %50 ]
%43 = call i8* @from_str(i8* %41, i32** %38)
%44 = call i32 @solve(i32** %38)
%45 = call i32 @to_str(i32** %38, i8* %36)
%46 = call i32 @append_str(i8** %4, i32 %42, i8* %36)
br i1 %26, label %50, label %47
47: ; preds = %39
%48 = add nsw i32 %40, 1
%49 = call i32 @load_bar(i32 %48, i32 %35, i32 100, i32 100)
br label %50
50: ; preds = %47, %39
%51 = phi i32 [ %48, %47 ], [ %40, %39 ]
%52 = load i8, i8* %43
%53 = icmp eq i8 %52, 0
br i1 %53, label %54, label %39
54: ; preds = %50
%55 = call i32 @free(i8* %27)
%56 = bitcast %struct.timeval* %7 to i8*
%57 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%58 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
%59 = load i32, i32* %58
%60 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%63 = load i32, i32* %62
%64 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%65 = load i32, i32* %64
%66 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%67 = load i8*, i8** %9
%68 = call i8* @basename(i8* %67)
%69 = call i32 @sprintf(i8* %66, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %68)
%70 = call i32* @fopen(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %76
72: ; preds = %54
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %66)
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %54
%77 = sub i32 %59, %63
%78 = mul i32 %77, 1000000
%79 = sub i32 %61, %65
%80 = add i32 %79, %78
%81 = sdiv i32 %80, 1000
%82 = sext i32 %81 to i64
%83 = load i8*, i8** %4
%84 = call i32 @fputs(i8* %83, i32* %70)
%85 = load i8*, i8** %4
%86 = call i32 @free(i8* %85)
%87 = call i32 @fclose(i32* %70)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i64 %82)
ret i32 0
}