#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *);
void read_data(char *filename, int size, int *input_a, int *input_b, int size_2,
               int *input_2a, int *input_2b) {
  FILE *fid;
  int i;
  char c;
  fid = fopen(filename, "r");
  if (fid == NULL) {
    printf("The file was not opened for reading\n");
    return;
  }
  i = 0;
  while (i < 2) {
    c = fgetc(fid);
    if (c == '\n') {
      i = i + 1;
    }
  };
  for (i = 0; i < size; i++) {
    fscanf(fid, "%d", &input_a[i]);
  }
  for (i = 0; i < size; i++) {
    fscanf(fid, "%d", &input_b[i]);
  }
  for (i = 0; i < size_2; i++) {
    fscanf(fid, "%d", &input_2a[i]);
  }
  for (i = 0; i < size_2; i++) {
    fscanf(fid, "%d", &input_2b[i]);
  }
  fclose(fid);
}


x86 assembly (clang, -O0):
<read_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11a3 <read_data+0x53>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
jmp    12e4 <read_data+0x194>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jge    11db <read_data+0x8b>
mov    -0x38(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x3d(%rbp)
movsbl -0x3d(%rbp),%eax
cmp    $0xa,%eax
jne    11d6 <read_data+0x86>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11aa <read_data+0x5a>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121b <read_data+0xcb>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe1f(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e2 <read_data+0x92>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    125b <read_data+0x10b>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xddf(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1222 <read_data+0xd2>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    129b <read_data+0x14b>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd9f(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1262 <read_data+0x112>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12db <read_data+0x18b>
mov    -0x38(%rbp),%rdi
mov    0x10(%rbp),%rdx
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd5f(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a2 <read_data+0x152>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8d,%ebx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,0xc(%rsp)
mov    0x50(%rsp),%rbp
lea    0xe86(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     129e <read_data+0x14e>
mov    %rax,%r13
mov    %ebx,0x8(%rsp)
mov    %rbp,0x10(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1060 <fgetc@plt>
xor    %ecx,%ecx
cmp    $0xa,%al
sete   %cl
add    %ecx,%ebx
cmp    $0x2,%ebx
jb     11a0 <read_data+0x50>
mov    0xc(%rsp),%eax
test   %eax,%eax
mov    %r13,%rbx
jle    1218 <read_data+0xc8>
mov    %eax,%r13d
mov    %rbx,%rbp
mov    %r13,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
lea    0xe28(%rip),%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
add    $0x4,%r15
add    $0xffffffffffffffff,%rbx
jne    11d0 <read_data+0x80>
cmpl   $0x0,0xc(%rsp)
mov    %rbp,%rbx
jle    1218 <read_data+0xc8>
lea    0xe05(%rip),%r15
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <fscanf@plt>
add    $0x4,%r14
add    $0xffffffffffffffff,%r13
jne    1200 <read_data+0xb0>
mov    0x8(%rsp),%eax
test   %eax,%eax
mov    0x10(%rsp),%rbp
mov    %rbx,%r13
jle    1288 <read_data+0x138>
mov    %eax,%r14d
lea    0xdd0(%rip),%r15
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
add    $0x4,%r12
add    $0xffffffffffffffff,%rbx
jne    1240 <read_data+0xf0>
cmpl   $0x0,0x8(%rsp)
jle    1288 <read_data+0x138>
lea    0xd9c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <fscanf@plt>
add    $0x4,%rbp
add    $0xffffffffffffffff,%r14
jne    1270 <read_data+0x120>
mov    %r13,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fclose@plt>
lea    0xd60(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [37 x i8] c"The file was not opened for reading\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define void @read_data(i8* %0, i32 %1, i32* %2, i32* %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i8
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i32 %4, i32* %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%18 = load i8*, i8** %8
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %15
%20 = load i32*, i32** %15
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %7
%23 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %101
24: ; preds = %7
store i32 0, i32* %16
br label %25
25: ; preds = %37, %24
%26 = load i32, i32* %16
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32*, i32** %15
%30 = call signext i8 @fgetc(i32* %29)
store i8 %30, i8* %17
%31 = load i8, i8* %17
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load i32, i32* %16
%36 = add nsw i32 %35, 1
store i32 %36, i32* %16
br label %37
37: ; preds = %34, %28
br label %25
38: ; preds = %25
store i32 0, i32* %16
br label %39
39: ; preds = %50, %38
%40 = load i32, i32* %16
%41 = load i32, i32* %9
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32*, i32** %15
%45 = load i32*, i32** %10
%46 = load i32, i32* %16
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
%49 = call i32 @fscanf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %48)
br label %50
50: ; preds = %43
%51 = load i32, i32* %16
%52 = add nsw i32 %51, 1
store i32 %52, i32* %16
br label %39
53: ; preds = %39
store i32 0, i32* %16
br label %54
54: ; preds = %65, %53
%55 = load i32, i32* %16
%56 = load i32, i32* %9
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %68
58: ; preds = %54
%59 = load i32*, i32** %15
%60 = load i32*, i32** %11
%61 = load i32, i32* %16
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = call i32 @fscanf(i32* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %63)
br label %65
65: ; preds = %58
%66 = load i32, i32* %16
%67 = add nsw i32 %66, 1
store i32 %67, i32* %16
br label %54
68: ; preds = %54
store i32 0, i32* %16
br label %69
69: ; preds = %80, %68
%70 = load i32, i32* %16
%71 = load i32, i32* %12
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %83
73: ; preds = %69
%74 = load i32*, i32** %15
%75 = load i32*, i32** %13
%76 = load i32, i32* %16
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
%79 = call i32 @fscanf(i32* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %78)
br label %80
80: ; preds = %73
%81 = load i32, i32* %16
%82 = add nsw i32 %81, 1
store i32 %82, i32* %16
br label %69
83: ; preds = %69
store i32 0, i32* %16
br label %84
84: ; preds = %95, %83
%85 = load i32, i32* %16
%86 = load i32, i32* %12
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %98
88: ; preds = %84
%89 = load i32*, i32** %15
%90 = load i32*, i32** %14
%91 = load i32, i32* %16
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %90, i64 %92
%94 = call i32 @fscanf(i32* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %93)
br label %95
95: ; preds = %88
%96 = load i32, i32* %16
%97 = add nsw i32 %96, 1
store i32 %97, i32* %16
br label %84
98: ; preds = %84
%99 = load i32*, i32** %15
%100 = call i32 @fclose(i32* %99)
br label %101
101: ; preds = %98, %22
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [36 x i8] c"The file was not opened for reading\00"
define void @read_data(i8* nocapture %0, i32 %1, i32* %2, i32* %3, i32 %4, i32* %5, i32* %6) {
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %59
12: ; preds = %16
%13 = icmp sgt i32 %1, 0
br i1 %13, label %14, label %32
14: ; preds = %12
%15 = zext i32 %1 to i64
br label %26
16: ; preds = %7, %16
%17 = phi i32 [ %21, %16 ], [ 0, %7 ]
%18 = tail call signext i8 @fgetc(i32* %8)
%19 = icmp eq i8 %18, 10
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %17, %20
%22 = icmp ult i32 %21, 2
br i1 %22, label %16, label %12
23: ; preds = %26
br i1 %13, label %24, label %32
24: ; preds = %23
%25 = zext i32 %1 to i64
br label %36
26: ; preds = %14, %26
%27 = phi i64 [ 0, %14 ], [ %30, %26 ]
%28 = getelementptr inbounds i32, i32* %2, i64 %27
%29 = tail call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %28)
%30 = add nuw nsw i64 %27, 1
%31 = icmp eq i64 %30, %15
br i1 %31, label %23, label %26
32: ; preds = %36, %12, %23
%33 = icmp sgt i32 %4, 0
br i1 %33, label %34, label %57
34: ; preds = %32
%35 = zext i32 %4 to i64
br label %45
36: ; preds = %24, %36
%37 = phi i64 [ 0, %24 ], [ %40, %36 ]
%38 = getelementptr inbounds i32, i32* %3, i64 %37
%39 = tail call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %38)
%40 = add nuw nsw i64 %37, 1
%41 = icmp eq i64 %40, %25
br i1 %41, label %32, label %36
42: ; preds = %45
br i1 %33, label %43, label %57
43: ; preds = %42
%44 = zext i32 %4 to i64
br label %51
45: ; preds = %34, %45
%46 = phi i64 [ 0, %34 ], [ %49, %45 ]
%47 = getelementptr inbounds i32, i32* %5, i64 %46
%48 = tail call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %47)
%49 = add nuw nsw i64 %46, 1
%50 = icmp eq i64 %49, %35
br i1 %50, label %42, label %45
51: ; preds = %43, %51
%52 = phi i64 [ 0, %43 ], [ %55, %51 ]
%53 = getelementptr inbounds i32, i32* %6, i64 %52
%54 = tail call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %53)
%55 = add nuw nsw i64 %52, 1
%56 = icmp eq i64 %55, %44
br i1 %56, label %57, label %51
57: ; preds = %51, %32, %42
%58 = tail call i32 @fclose(i32* %8)
br label %59
59: ; preds = %57, %10
ret void
}