#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*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int skip_lines(int /*<<< orphan*/ *, int);
int read_solution_banner(FILE *fp, int *len, int *dim) {
  const int size = 13;
  const char banner[] = "THE SOLUTIONS";
  char buffer[size];
  char c;
  int go_on = 1;
  int cnt = 0;
  int found = 0;
  do {
    go_on = fscanf(fp, "%c", &c);
    if (go_on != 1)
      break;
    if (cnt < size)
      buffer[cnt++] = c;
    else {
      int i;
      for (i = 0; i < size - 1; i++)
        buffer[i] = buffer[i + 1];
      buffer[size - 1] = c;
      found = 1;
      for (i = 0; i < size; i++)
        if (buffer[i] != banner[i]) {
          found = 0;
          break;
        }
      go_on = (found == 0);
    }
  } while (go_on == 1);
  if (found == 0)
    printf("Did not find the solution banner!\n");
  else {
    go_on = skip_lines(fp, 1);
    if (go_on == 0) {
      fscanf(fp, "%d", len);
      fscanf(fp, "%d", dim);
      printf("Length : %d and dimension : %d\n", *len, *dim);
      go_on = skip_lines(fp, 2);
    }
  }
  return go_on;
}


x86 assembly (clang, -O0):
<read_solution_banner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xd,-0x1c(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x2a(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x22(%rbp)
mov    0xea6(%rip),%ax
mov    %ax,-0x1e(%rbp)
mov    %rsp,%rax
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
lea    -0x39(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x1,-0x40(%rbp)
je     11ae <read_solution_banner+0x7e>
jmp    1279 <read_solution_banner+0x149>
cmpl   $0xd,-0x44(%rbp)
jge    11d1 <read_solution_banner+0xa1>
mov    -0x39(%rbp),%cl
mov    -0x44(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x44(%rbp)
cltq
mov    %cl,-0x60(%rbp,%rax,1)
jmp    126a <read_solution_banner+0x13a>
movl   $0x0,-0x4c(%rbp)
cmpl   $0xc,-0x4c(%rbp)
jge    1204 <read_solution_banner+0xd4>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,1),%cl
movslq -0x4c(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11d8 <read_solution_banner+0xa8>
mov    -0x39(%rbp),%al
mov    %al,-0x54(%rbp)
movl   $0x1,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0xd,-0x4c(%rbp)
jge    125b <read_solution_banner+0x12b>
movslq -0x4c(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
movslq -0x4c(%rbp),%rcx
movsbl -0x2a(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1248 <read_solution_banner+0x118>
movl   $0x0,-0x48(%rbp)
jmp    125b <read_solution_banner+0x12b>
jmp    124d <read_solution_banner+0x11d>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1218 <read_solution_banner+0xe8>
cmpl   $0x0,-0x48(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x40(%rbp)
jmp    126f <read_solution_banner+0x13f>
cmpl   $0x1,-0x40(%rbp)
je     1186 <read_solution_banner+0x56>
cmpl   $0x0,-0x48(%rbp)
jne    1296 <read_solution_banner+0x166>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    130d <read_solution_banner+0x1dd>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <skip_lines@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    1308 <read_solution_banner+0x1d8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd74(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd5e(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <skip_lines@plt>
mov    %eax,-0x40(%rbp)
jmp    130d <read_solution_banner+0x1dd>
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    %rcx,%rsp
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_solution_banner>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xea2(%rip),%rsi
lea    0xf(%rsp),%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
jne    128a <read_solution_banner+0x14a>
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
lea    0x11(%rsp),%r14
lea    0xe75(%rip),%r12
lea    0xf(%rsp),%r13
xor    %r15d,%r15d
jmp    11c9 <read_solution_banner+0x89>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0xf(%rsp),%eax
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,0x10(%rsp,%rcx,1)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
cmp    $0x1,%eax
jne    1288 <read_solution_banner+0x148>
cmp    $0xd,%r15d
jl     11a0 <read_solution_banner+0x60>
mov    (%r14),%rdx
mov    0x8(%r14),%ecx
mov    %ecx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
movzbl 0xf(%rsp),%eax
mov    %al,0x1c(%rsp)
movq   %rdx,%xmm0
movq   %xmm0,%rdx
movabs $0x554c4f5320454854,%rsi
4f 4c 55
cmp    %rsi,%rdx
jne    11b0 <read_solution_banner+0x70>
cmp    $0x54,%cl
jne    11b0 <read_solution_banner+0x70>
cmpb   $0x49,0x19(%rsp)
jne    11b0 <read_solution_banner+0x70>
cmpb   $0x4f,0x1a(%rsp)
jne    11b0 <read_solution_banner+0x70>
cmpb   $0x4e,0x1b(%rsp)
jne    11b0 <read_solution_banner+0x70>
cmp    $0x53,%al
jne    11b0 <read_solution_banner+0x70>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <skip_lines@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1296 <read_solution_banner+0x156>
lea    0xdca(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    0x30(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    (%r14),%esi
mov    0x0(%rbp),%edx
lea    0xd96(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <skip_lines@plt>
mov    %eax,%ebp
jmp    1296 <read_solution_banner+0x156>
mov    %eax,%ebp
lea    0xd95(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.read_solution_banner.banner = [14 x i8] c"THE SOLUTIONS\00"
@.str = [3 x i8] c"%c\00"
@.str.1 = [35 x i8] c"Did not find the solution banner!\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [32 x i8] c"Length : %d and dimension : %d\0A\00"
define i32 @read_solution_banner(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [14 x i8]
%9 = alloca i8*
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 13, i32* %7
%15 = bitcast [14 x i8]* %8 to i8*
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %9
%17 = alloca i8, i64 13
store i32 1, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %18
18: ; preds = %77, %3
%19 = load i32*, i32** %4
%20 = call i32 (i32*, i8*, ...) @fscanf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 %20, i32* %11
%21 = load i32, i32* %11
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %18
br label %80
24: ; preds = %18
%25 = load i32, i32* %12
%26 = icmp slt i32 %25, 13
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8, i8* %10
%29 = load i32, i32* %12
%30 = add nsw i32 %29, 1
store i32 %30, i32* %12
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %17, i64 %31
store i8 %28, i8* %32
br label %76
33: ; preds = %24
store i32 0, i32* %14
br label %34
34: ; preds = %46, %33
%35 = load i32, i32* %14
%36 = icmp slt i32 %35, 12
br i1 %36, label %37, label %49
37: ; preds = %34
%38 = load i32, i32* %14
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %17, i64 %40
%42 = load i8, i8* %41
%43 = load i32, i32* %14
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %17, i64 %44
store i8 %42, i8* %45
br label %46
46: ; preds = %37
%47 = load i32, i32* %14
%48 = add nsw i32 %47, 1
store i32 %48, i32* %14
br label %34
49: ; preds = %34
%50 = load i8, i8* %10
%51 = getelementptr inbounds i8, i8* %17, i64 12
store i8 %50, i8* %51
store i32 1, i32* %13
store i32 0, i32* %14
br label %52
52: ; preds = %69, %49
%53 = load i32, i32* %14
%54 = icmp slt i32 %53, 13
br i1 %54, label %55, label %72
55: ; preds = %52
%56 = load i32, i32* %14
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %17, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = load i32, i32* %14
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [14 x i8], [14 x i8]* %8, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %60, %65
br i1 %66, label %67, label %68
67: ; preds = %55
store i32 0, i32* %13
br label %72
68: ; preds = %55
br label %69
69: ; preds = %68
%70 = load i32, i32* %14
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %52
72: ; preds = %67, %52
%73 = load i32, i32* %13
%74 = icmp eq i32 %73, 0
%75 = zext i1 %74 to i32
store i32 %75, i32* %11
br label %76
76: ; preds = %72, %27
br label %77
77: ; preds = %76
%78 = load i32, i32* %11
%79 = icmp eq i32 %78, 1
br i1 %79, label %18, label %80
80: ; preds = %77, %23
%81 = load i32, i32* %13
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %105
85: ; preds = %80
%86 = load i32*, i32** %4
%87 = call i32 @skip_lines(i32* %86, i32 1)
store i32 %87, i32* %11
%88 = load i32, i32* %11
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %104
90: ; preds = %85
%91 = load i32*, i32** %4
%92 = load i32*, i32** %5
%93 = call i32 (i32*, i8*, ...) @fscanf(i32* %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %92)
%94 = load i32*, i32** %4
%95 = load i32*, i32** %6
%96 = call i32 (i32*, i8*, ...) @fscanf(i32* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %95)
%97 = load i32*, i32** %5
%98 = load i32, i32* %97
%99 = load i32*, i32** %6
%100 = load i32, i32* %99
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %98, i32 %100)
%102 = load i32*, i32** %4
%103 = call i32 @skip_lines(i32* %102, i32 2)
store i32 %103, i32* %11
br label %104
104: ; preds = %90, %85
br label %105
105: ; preds = %104, %83
%106 = load i32, i32* %11
%107 = load i8*, i8** %9
ret i32 %106
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [32 x i8] c"Length : %d and dimension : %d\0A\00"
@str = [34 x i8] c"Did not find the solution banner!\00"
define i32 @read_solution_banner(i32* %0, i32* %1, i32* %2) {
%4 = alloca i8
%5 = alloca [13 x i8]
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 12
%8 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 1
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 8
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 9
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 10
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 11
%13 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %49
15: ; preds = %3
%16 = bitcast [13 x i8]* %5 to <8 x i8>*
br label %17
17: ; preds = %15, %45
%18 = phi i32 [ %46, %45 ], [ 0, %15 ]
%19 = icmp slt i32 %18, 13
br i1 %19, label %40, label %20
20: ; preds = %17
%21 = load i8, i8* %4
store i8 %21, i8* %7
%22 = load <8 x i8>, <8 x i8>* %16
%23 = freeze <8 x i8> %22
%24 = bitcast <8 x i8> %23 to i64
%25 = icmp eq i64 %24, 6146374809896175700
%26 = load i8, i8* %9
%27 = icmp eq i8 %26, 84
%28 = select i1 %25, i1 %27, i1 false
%29 = load i8, i8* %10
%30 = icmp eq i8 %29, 73
%31 = select i1 %28, i1 %30, i1 false
%32 = load i8, i8* %11
%33 = icmp eq i8 %32, 79
%34 = select i1 %31, i1 %33, i1 false
%35 = load i8, i8* %12
%36 = icmp eq i8 %35, 78
%37 = select i1 %34, i1 %36, i1 false
%38 = icmp eq i8 %21, 83
%39 = select i1 %37, i1 %38, i1 false
br i1 %39, label %52, label %45
40: ; preds = %17
%41 = load i8, i8* %4
%42 = add nsw i32 %18, 1
%43 = sext i32 %18 to i64
%44 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 %43
store i8 %41, i8* %44
br label %45
45: ; preds = %20, %40
%46 = phi i32 [ %42, %40 ], [ %18, %20 ]
%47 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%48 = icmp eq i32 %47, 1
br i1 %48, label %17, label %49
49: ; preds = %45, %3
%50 = phi i32 [ %13, %3 ], [ %47, %45 ]
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %62
52: ; preds = %20
%53 = call i32 @skip_lines(i32* %0, i32 1)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %52
%56 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%57 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%58 = load i32, i32* %1
%59 = load i32, i32* %2
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %58, i32 %59)
%61 = call i32 @skip_lines(i32* %0, i32 2)
br label %62
62: ; preds = %52, %55, %49
%63 = phi i32 [ %50, %49 ], [ %61, %55 ], [ %53, %52 ]
ret i32 %63
}