#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 */
scalar_t__ check_syslog_date_exim(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ parseEximFromBytesLine(char *, int /*<<< orphan*/);
int /*<<< orphan*/ parseEximToLine(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
void readEximLogFile(char *fn) {
  FILE *fp = NULL;
  char buf[1024];
  if ((fp = fopen(fn, "r")) == NULL) {
    fprintf(stderr, "fopen: %s: %s\n", fn, strerror(errno));
    exit(-1);
  }
  while ((fgets(buf, 1024, fp)) != NULL) {
    if ((check_syslog_date_exim(buf, strlen(buf))) > 0) {
      if ((strstr(buf, " <= ")) != NULL) {
        parseEximFromBytesLine(buf, strlen(buf));
      } else if ((strstr(buf, " => ")) != NULL)
        parseEximToLine(buf, strlen(buf));
    }
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<readEximLogFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1233 <readEximLogFile+0x83>
mov    0x2df4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x41c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x41c(%rbp),%edi
mov    -0x418(%rbp),%rdx
mov    %rax,%rcx
lea    0xdde(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
jmp    1238 <readEximLogFile+0x88>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1327 <readEximLogFile+0x177>
lea    -0x410(%rbp),%rax
mov    %rax,-0x428(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x428(%rbp),%rdi
mov    %eax,%esi
call   1080 <check_syslog_date_exim@plt>
cmp    $0x0,%rax
jle    1322 <readEximLogFile+0x172>
lea    -0x410(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     12d3 <readEximLogFile+0x123>
lea    -0x410(%rbp),%rax
mov    %rax,-0x430(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x430(%rbp),%rdi
mov    %eax,%esi
call   1060 <parseEximFromBytesLine@plt>
jmp    131d <readEximLogFile+0x16d>
lea    -0x410(%rbp),%rdi
lea    0xd35(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     1318 <readEximLogFile+0x168>
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x438(%rbp),%rdi
mov    %eax,%esi
call   10a0 <parseEximToLine@plt>
jmp    131d <readEximLogFile+0x16d>
jmp    1322 <readEximLogFile+0x172>
jmp    1238 <readEximLogFile+0x88>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readEximLogFile>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rbx
lea    0xe37(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1297 <readEximLogFile+0xe7>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     127f <readEximLogFile+0xcf>
mov    %rsp,%rbx
lea    0xe14(%rip),%r15
lea    0xe12(%rip),%r12
jmp    1234 <readEximLogFile+0x84>
cs nopw 0x0(%rax,%rax,1)
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <parseEximFromBytesLine@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     127f <readEximLogFile+0xcf>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <check_syslog_date_exim@plt>
test   %rax,%rax
jle    121f <readEximLogFile+0x6f>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10d0 <strstr@plt>
mov    %rbx,%rdi
test   %rax,%rax
jne    1210 <readEximLogFile+0x60>
mov    %r12,%rsi
call   10d0 <strstr@plt>
test   %rax,%rax
je     121f <readEximLogFile+0x6f>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <parseEximToLine@plt>
jmp    121f <readEximLogFile+0x6f>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d42(%rip),%rax
mov    (%rax),%ebp
mov    0x2d31(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd4d(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"fopen: %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [5 x i8] c" <= \00"
@.str.3 = [5 x i8] c" => \00"
define void @readEximLogFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [1024 x i8]
store i8* %0, i8** %2
store i32* null, i32** %3
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %2
%11 = load i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %12)
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %1
br label %16
16: ; preds = %47, %15
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = load i32*, i32** %3
%19 = call i32* @fgets(i8* %17, i32 1024, i32* %18)
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %48
21: ; preds = %16
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = call i64 @check_syslog_date_exim(i8* %22, i32 %24)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %47
27: ; preds = %21
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%29 = call i32* @strstr(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%34 = call i32 @strlen(i8* %33)
%35 = call i32 @parseEximFromBytesLine(i8* %32, i32 %34)
br label %46
36: ; preds = %27
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%38 = call i32* @strstr(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32* %38, null
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = call i32 @parseEximToLine(i8* %41, i32 %43)
br label %45
45: ; preds = %40, %36
br label %46
46: ; preds = %45, %31
br label %47
47: ; preds = %46, %21
br label %16
48: ; preds = %16
%49 = load i32*, i32** %3
%50 = call i32 @fclose(i32* %49)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"fopen: %s: %s\0A\00"
@errno = global i32 0
@.str.2 = [5 x i8] c" <= \00"
@.str.3 = [5 x i8] c" => \00"
define void @readEximLogFile(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32* @fgets(i8* %3, i32 1024, i32* %4)
%8 = icmp eq i32* %7, null
br i1 %8, label %34, label %15
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i32, i32* @errno
%12 = tail call i8* @strerror(i32 %11)
%13 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %12)
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %6, %31
%16 = call i32 @strlen(i8* %3)
%17 = call i64 @check_syslog_date_exim(i8* %3, i32 %16)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = call i32* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = call i32 @strlen(i8* %3)
%24 = call i32 @parseEximFromBytesLine(i8* %3, i32 %23)
br label %31
25: ; preds = %19
%26 = call i32* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i32 @strlen(i8* %3)
%30 = call i32 @parseEximToLine(i8* %3, i32 %29)
br label %31
31: ; preds = %22, %28, %25, %15
%32 = call i32* @fgets(i8* %3, i32 1024, i32* %4)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %15
34: ; preds = %31, %6
%35 = call i32 @fclose(i32* %4)
ret void
}