#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 read4();
unsigned long long read8();
int /*<<< orphan*/ read_event_file(char *, unsigned long long);
char *read_string();
void read_event_files(void) {
  unsigned long long size;
  char *sys;
  int systems;
  int count;
  int i, x;
  systems = read4();
  for (i = 0; i < systems; i++) {
    sys = read_string();
    count = read4();
    for (x = 0; x < count; x++) {
      size = read8();
      read_event_file(sys, size);
    }
  }
}


x86 assembly (clang, -O0):
<read_event_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <read4@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c6 <read_event_files+0x86>
mov    $0x0,%al
call   1060 <read_string@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <read4@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11b3 <read_event_files+0x73>
mov    $0x0,%al
call   1040 <read8@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <read_event_file@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1181 <read_event_files+0x41>
jmp    11b8 <read_event_files+0x78>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <read_event_files+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_event_files>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <read4@plt>
test   %eax,%eax
jle    1199 <read_event_files+0x59>
mov    %eax,%r14d
xor    %r15d,%r15d
jmp    1169 <read_event_files+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    %r14d,%r15d
je     1199 <read_event_files+0x59>
xor    %eax,%eax
call   1060 <read_string@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <read4@plt>
test   %eax,%eax
jle    1160 <read_event_files+0x20>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <read8@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <read_event_file@plt>
add    $0xffffffff,%ebp
jne    1180 <read_event_files+0x40>
jmp    1160 <read_event_files+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @read_event_files() {
%1 = alloca i64
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (...) @read4()
store i32 %7, i32* %3
store i32 0, i32* %5
br label %8
8: ; preds = %28, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = call i8* (...) @read_string()
store i8* %13, i8** %2
%14 = call i32 (...) @read4()
store i32 %14, i32* %4
store i32 0, i32* %6
br label %15
15: ; preds = %24, %12
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = call i64 (...) @read8()
store i64 %20, i64* %1
%21 = load i8*, i8** %2
%22 = load i64, i64* %1
%23 = call i32 @read_event_file(i8* %21, i64 %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %15
27: ; preds = %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %8
31: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @read_event_files() {
%1 = tail call i32 (...) @read4()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %17
3: ; preds = %0, %14
%4 = phi i32 [ %15, %14 ], [ 0, %0 ]
%5 = tail call i8* (...) @read_string()
%6 = tail call i32 (...) @read4()
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3, %8
%9 = phi i32 [ %12, %8 ], [ 0, %3 ]
%10 = tail call i64 (...) @read8()
%11 = tail call i32 @read_event_file(i8* %5, i64 %10)
%12 = add nuw nsw i32 %9, 1
%13 = icmp eq i32 %12, %6
br i1 %13, label %14, label %8
14: ; preds = %8, %3
%15 = add nuw nsw i32 %4, 1
%16 = icmp eq i32 %15, %1
br i1 %16, label %17, label %3
17: ; preds = %14, %0
ret void
}