#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*/ ttm;
typedef scalar_t__ time_t;
struct tm {
  int tm_isdst;
  int tm_year;
  int tm_mon;
  int tm_mday;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ add_verdb(char *, int, int, scalar_t__);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
scalar_t__ isspace(char);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
scalar_t__ mktime(struct tm *);
int sscanf(char *, char *, int *, char *, int *, int *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
void read_verdb(char const *name) {
  FILE *f;
  char buf[78];
  char version[sizeof(buf)];
  int patch, revsum, n, buflen, year, month, mday;
  struct tm ttm;
  time_t tt;
  if (!(f = fopen(name, "r"))) {
    fprintf(stderr, "cannot open database file '%s'\n", name);
    return;
  }
  while (fgets(buf, sizeof(buf), f)) {
    if (strlen(buf) >= sizeof(buf) - 1 && buf[sizeof(buf) - 2] != '\n') {
      fprintf(stderr, "%s: line too long\n", name);
      exit(1);
    }
    if (buf[0] == '#')
      continue;
    if (buf[0] == '\n')
      continue;
    buflen = strlen(buf);
    while (buflen > 0 && isspace(buf[buflen - 1]))
      buf[--buflen] = 0;
    tt = 0;
    if (sscanf(buf, "%d %s %d %d/%d/%d%n", &revsum, version, &patch, &year,
               &month, &mday, &n) == 6 &&
        !buf[n]) {
      if (patch < 0 || revsum < 0 || year < 1970 || year > 2040 || month < 1 ||
          month > 12 || mday < 1 || mday > 31) {
        fprintf(stderr, "%s: line invalid\n", name);
        exit(1);
      }
      memset(&ttm, 0, sizeof(ttm));
      ttm.tm_isdst = -1;
      ttm.tm_year = year - 1900;
      ttm.tm_mon = month - 1;
      ttm.tm_mday = mday;
      if ((tt = mktime(&ttm)) == (time_t)-1) {
        fprintf(stderr, "%s: time specification is invalid\n", name);
        exit(1);
      }
    } else if (sscanf(buf, "%d %s %d%n", &revsum, version, &patch, &n) != 3 ||
               buf[n] || patch < 0 || revsum < 0) {
      fprintf(stderr, "%s: line invalid\n", name);
      exit(1);
    }
    add_verdb(version, patch, revsum, tt);
  }
  if (ferror(f)) {
    fprintf(stderr, "%s: read error\n", name);
    exit(1);
  }
  fclose(f);
}


x86 assembly (clang, -O0):
<read_verdb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    120b <read_verdb+0x4b>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe01(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1590 <read_verdb+0x3d0>
jmp    1210 <read_verdb+0x50>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x4e,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1551 <read_verdb+0x391>
lea    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
cltq
cmp    $0x4d,%rax
jb     1271 <read_verdb+0xb1>
movsbl -0x14(%rbp),%eax
cmp    $0xa,%eax
je     1271 <read_verdb+0xb1>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdc0(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movsbl -0x60(%rbp),%eax
cmp    $0x23,%eax
jne    1283 <read_verdb+0xc3>
jmp    1210 <read_verdb+0x50>
movsbl -0x60(%rbp),%eax
cmp    $0xa,%eax
jne    1295 <read_verdb+0xd5>
jmp    1210 <read_verdb+0x50>
lea    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc0(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc0(%rbp)
mov    %al,-0xe9(%rbp)
jle    12db <read_verdb+0x11b>
mov    -0xc0(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    12ee <read_verdb+0x12e>
jmp    1309 <read_verdb+0x149>
mov    -0xc0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc0(%rbp)
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
jmp    12a4 <read_verdb+0xe4>
movq   $0x0,-0xe8(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rcx
lea    0xd0f(%rip),%rsi
lea    -0xb8(%rbp),%rdx
lea    -0xb4(%rbp),%r8
lea    -0xc4(%rbp),%r9
lea    -0xc8(%rbp),%r11
lea    -0xcc(%rbp),%r10
lea    -0xbc(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x6,%eax
jne    149f <read_verdb+0x2df>
movslq -0xbc(%rbp),%rax
cmpb   $0x0,-0x60(%rbp,%rax,1)
jne    149f <read_verdb+0x2df>
cmpl   $0x0,-0xb4(%rbp)
jl     13ee <read_verdb+0x22e>
cmpl   $0x0,-0xb8(%rbp)
jl     13ee <read_verdb+0x22e>
cmpl   $0x7b2,-0xc4(%rbp)
jl     13ee <read_verdb+0x22e>
cmpl   $0x7f8,-0xc4(%rbp)
jg     13ee <read_verdb+0x22e>
cmpl   $0x1,-0xc8(%rbp)
jl     13ee <read_verdb+0x22e>
cmpl   $0xc,-0xc8(%rbp)
jg     13ee <read_verdb+0x22e>
cmpl   $0x1,-0xcc(%rbp)
jl     13ee <read_verdb+0x22e>
cmpl   $0x1f,-0xcc(%rbp)
jle    1411 <read_verdb+0x251>
mov    0x2beb(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xc47(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0xffffffff,-0xe0(%rbp)
ff ff ff
mov    -0xc4(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0xdc(%rbp)
mov    -0xc8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xd8(%rbp)
mov    -0xcc(%rbp),%eax
mov    %eax,-0xd4(%rbp)
lea    -0xe0(%rbp),%rdi
call   10b0 <mktime@plt>
mov    %rax,-0xe8(%rbp)
cmp    $0xffffffffffffffff,%rax
jne    149a <read_verdb+0x2da>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xbd0(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    152d <read_verdb+0x36d>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rcx
lea    0xbcd(%rip),%rsi
lea    -0xb8(%rbp),%rdx
lea    -0xb4(%rbp),%r8
lea    -0xbc(%rbp),%r9
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
jne    1505 <read_verdb+0x345>
movslq -0xbc(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    1505 <read_verdb+0x345>
cmpl   $0x0,-0xb4(%rbp)
jl     1505 <read_verdb+0x345>
cmpl   $0x0,-0xb8(%rbp)
jge    1528 <read_verdb+0x368>
mov    0x2ad4(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xb30(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    152d <read_verdb+0x36d>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
mov    -0xb8(%rbp),%edx
mov    -0xe8(%rbp),%rcx
call   10d0 <add_verdb@plt>
jmp    1210 <read_verdb+0x50>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1587 <read_verdb+0x3c7>
mov    0x2a75(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xb11(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_verdb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdi,%rbx
lea    0xe25(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     142d <read_verdb+0x26d>
mov    %rax,%r15
mov    %rbx,0x18(%rsp)
lea    0x40(%rsp),%rdi
mov    $0x4e,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1402 <read_verdb+0x242>
lea    0x40(%rsp),%rbx
lea    0x90(%rsp),%r14
lea    0x14(%rsp),%r13
jmp    1241 <read_verdb+0x81>
mov    %r14,%rdi
call   10d0 <add_verdb@plt>
mov    %rbx,%rdi
mov    $0x4e,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1402 <read_verdb+0x242>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x4d,%eax
jb     125c <read_verdb+0x9c>
cmpb   $0xa,0x8c(%rsp)
0a
jne    1456 <read_verdb+0x296>
mov    0x40(%rsp),%al
cmp    $0xa,%al
je     1228 <read_verdb+0x68>
cmp    $0x23,%al
je     1228 <read_verdb+0x68>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    12a3 <read_verdb+0xe3>
mov    %eax,%r12d
add    $0x1,%r12
nopl   0x0(%rax,%rax,1)
lea    -0x2(%r12),%ebp
movsbl 0x40(%rsp,%rbp,1),%edi
call   1070 <isspace@plt>
test   %rax,%rax
je     12a3 <read_verdb+0xe3>
movb   $0x0,0x40(%rsp,%rbp,1)
add    $0xffffffffffffffff,%r12
cmp    $0x1,%r12
ja     1280 <read_verdb+0xc0>
sub    $0x8,%rsp
mov    %rbx,%rdi
lea    0xd84(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %r14,%rcx
mov    %r13,%r8
lea    0x34(%rsp),%r9
xor    %eax,%eax
lea    0x18(%rsp),%rbp
push   %rbp
lea    0x34(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
call   10a0 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x6,%eax
jne    12ef <read_verdb+0x12f>
movslq 0x10(%rsp),%rax
cmpb   $0x0,0x40(%rsp,%rax,1)
je     1348 <read_verdb+0x188>
mov    %rbx,%rdi
lea    0xd85(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rcx
mov    %r13,%r8
lea    0x10(%rsp),%r9
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
jne    1468 <read_verdb+0x2a8>
movslq 0x10(%rsp),%rax
cmpb   $0x0,0x40(%rsp,%rax,1)
jne    1468 <read_verdb+0x2a8>
mov    0x14(%rsp),%esi
test   %esi,%esi
js     1468 <read_verdb+0x2a8>
mov    0xc(%rsp),%edx
test   %edx,%edx
js     1468 <read_verdb+0x2a8>
xor    %ecx,%ecx
jmp    1220 <read_verdb+0x60>
cmpl   $0x0,0x14(%rsp)
js     1468 <read_verdb+0x2a8>
cmpl   $0x0,0xc(%rsp)
js     1468 <read_verdb+0x2a8>
mov    0x2c(%rsp),%eax
cmp    $0x7b2,%eax
jl     1468 <read_verdb+0x2a8>
cmp    $0x7f8,%eax
jg     1468 <read_verdb+0x2a8>
mov    0x28(%rsp),%eax
test   %eax,%eax
jle    1468 <read_verdb+0x2a8>
cmp    $0xc,%eax
jg     1468 <read_verdb+0x2a8>
mov    0x24(%rsp),%eax
test   %eax,%eax
jle    1468 <read_verdb+0x2a8>
cmp    $0x20,%eax
jge    1468 <read_verdb+0x2a8>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0xffffffff,0x30(%rsp)
ff
mov    0x2c(%rsp),%eax
mov    $0xfffff894,%ecx
add    %ecx,%eax
mov    %eax,0x34(%rsp)
mov    0x28(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x38(%rsp)
mov    0x24(%rsp),%eax
mov    %eax,0x3c(%rsp)
mov    %rbp,%rdi
call   10b0 <mktime@plt>
cmp    $0xffffffffffffffff,%rax
je     148c <read_verdb+0x2cc>
mov    %rax,%rcx
mov    0x14(%rsp),%esi
mov    0xc(%rsp),%edx
jmp    1220 <read_verdb+0x60>
mov    %r15,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    149e <read_verdb+0x2de>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
lea    0xbc5(%rip),%rsi
mov    %rbx,%rdx
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <fprintf@plt>
mov    0x2b83(%rip),%rax
mov    (%rax),%edi
lea    0xbbc(%rip),%rsi
jmp    1478 <read_verdb+0x2b8>
mov    0x2b71(%rip),%rax
mov    (%rax),%edi
lea    0xbd1(%rip),%rsi
mov    0x18(%rsp),%rdx
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2b4d(%rip),%rax
mov    (%rax),%edi
lea    0xbbf(%rip),%rsi
jmp    1478 <read_verdb+0x2b8>
mov    0x2b3b(%rip),%rax
mov    (%rax),%edi
lea    0xbdb(%rip),%rsi
jmp    1478 <read_verdb+0x2b8>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"cannot open database file '%s'\0A\00"
@.str.2 = [19 x i8] c"%s: line too long\0A\00"
@.str.3 = [20 x i8] c"%d %s %d %d/%d/%d%n\00"
@.str.4 = [18 x i8] c"%s: line invalid\0A\00"
@.str.5 = [35 x i8] c"%s: time specification is invalid\0A\00"
@.str.6 = [11 x i8] c"%d %s %d%n\00"
@.str.7 = [16 x i8] c"%s: read error\0A\00"
define void @read_verdb(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [78 x i8]
%5 = alloca [78 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.tm
%14 = alloca i64
store i8* %0, i8** %2
%15 = load i8*, i8** %2
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %3
%17 = icmp ne i32* %16, null
br i1 %17, label %22, label %18
18: ; preds = %1
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %2
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %177
22: ; preds = %1
br label %23
23: ; preds = %159, %54, %48, %22
%24 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%25 = load i32*, i32** %3
%26 = call i64 @fgets(i8* %24, i32 78, i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %165
28: ; preds = %23
%29 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = sext i32 %30 to i64
%32 = icmp uge i64 %31, 77
br i1 %32, label %33, label %43
33: ; preds = %28
%34 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 76
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 10
br i1 %37, label %38, label %43
38: ; preds = %33
%39 = load i32, i32* @stderr
%40 = load i8*, i8** %2
%41 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %33, %28
%44 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 35
br i1 %47, label %48, label %49
48: ; preds = %43
br label %23
49: ; preds = %43
%50 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 10
br i1 %53, label %54, label %55
54: ; preds = %49
br label %23
55: ; preds = %49
%56 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%57 = call i32 @strlen(i8* %56)
store i32 %57, i32* %9
br label %58
58: ; preds = %71, %55
%59 = load i32, i32* %9
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %58
%62 = load i32, i32* %9
%63 = sub nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = call i64 @isspace(i8 signext %66)
%68 = icmp ne i64 %67, 0
br label %69
69: ; preds = %61, %58
%70 = phi i1 [ false, %58 ], [ %68, %61 ]
br i1 %70, label %71, label %76
71: ; preds = %69
%72 = load i32, i32* %9
%73 = add nsw i32 %72, -1
store i32 %73, i32* %9
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 %74
store i8 0, i8* %75
br label %58
76: ; preds = %69
store i64 0, i64* %14
%77 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%78 = getelementptr inbounds [78 x i8], [78 x i8]* %5, i64 0, i64 0
%79 = call i32 (i8*, i8*, i32*, i8*, i32*, i32*, ...) @sscanf(i8* %77, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32* %7, i8* %78, i32* %6, i32* %10, i32* %11, i32* %12, i32* %8)
%80 = icmp eq i32 %79, 6
br i1 %80, label %81, label %135
81: ; preds = %76
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = icmp ne i8 %85, 0
br i1 %86, label %135, label %87
87: ; preds = %81
%88 = load i32, i32* %6
%89 = icmp slt i32 %88, 0
br i1 %89, label %111, label %90
90: ; preds = %87
%91 = load i32, i32* %7
%92 = icmp slt i32 %91, 0
br i1 %92, label %111, label %93
93: ; preds = %90
%94 = load i32, i32* %10
%95 = icmp slt i32 %94, 1970
br i1 %95, label %111, label %96
96: ; preds = %93
%97 = load i32, i32* %10
%98 = icmp sgt i32 %97, 2040
br i1 %98, label %111, label %99
99: ; preds = %96
%100 = load i32, i32* %11
%101 = icmp slt i32 %100, 1
br i1 %101, label %111, label %102
102: ; preds = %99
%103 = load i32, i32* %11
%104 = icmp sgt i32 %103, 12
br i1 %104, label %111, label %105
105: ; preds = %102
%106 = load i32, i32* %12
%107 = icmp slt i32 %106, 1
br i1 %107, label %111, label %108
108: ; preds = %105
%109 = load i32, i32* %12
%110 = icmp sgt i32 %109, 31
br i1 %110, label %111, label %116
111: ; preds = %108, %105, %102, %99, %96, %93, %90, %87
%112 = load i32, i32* @stderr
%113 = load i8*, i8** %2
%114 = call i32 @fprintf(i32 %112, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %113)
%115 = call i32 @exit(i32 1)
unreachable
116: ; preds = %108
%117 = call i32 @memset(%struct.tm* %13, i32 0, i32 16)
%118 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
store i32 -1, i32* %118
%119 = load i32, i32* %10
%120 = sub nsw i32 %119, 1900
%121 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 1
store i32 %120, i32* %121
%122 = load i32, i32* %11
%123 = sub nsw i32 %122, 1
%124 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 2
store i32 %123, i32* %124
%125 = load i32, i32* %12
%126 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 3
store i32 %125, i32* %126
%127 = call i64 @mktime(%struct.tm* %13)
store i64 %127, i64* %14
%128 = icmp eq i64 %127, -1
br i1 %128, label %129, label %134
129: ; preds = %116
%130 = load i32, i32* @stderr
%131 = load i8*, i8** %2
%132 = call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* %131)
%133 = call i32 @exit(i32 1)
unreachable
134: ; preds = %116
br label %159
135: ; preds = %81, %76
%136 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 0
%137 = getelementptr inbounds [78 x i8], [78 x i8]* %5, i64 0, i64 0
%138 = call i32 (i8*, i8*, i32*, i8*, i32*, i32*, ...) @sscanf(i8* %136, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32* %7, i8* %137, i32* %6, i32* %8)
%139 = icmp ne i32 %138, 3
br i1 %139, label %153, label %140
140: ; preds = %135
%141 = load i32, i32* %8
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [78 x i8], [78 x i8]* %4, i64 0, i64 %142
%144 = load i8, i8* %143
%145 = sext i8 %144 to i32
%146 = icmp ne i32 %145, 0
br i1 %146, label %153, label %147
147: ; preds = %140
%148 = load i32, i32* %6
%149 = icmp slt i32 %148, 0
br i1 %149, label %153, label %150
150: ; preds = %147
%151 = load i32, i32* %7
%152 = icmp slt i32 %151, 0
br i1 %152, label %153, label %158
153: ; preds = %150, %147, %140, %135
%154 = load i32, i32* @stderr
%155 = load i8*, i8** %2
%156 = call i32 @fprintf(i32 %154, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %155)
%157 = call i32 @exit(i32 1)
unreachable
158: ; preds = %150
br label %159
159: ; preds = %158, %134
%160 = getelementptr inbounds [78 x i8], [78 x i8]* %5, i64 0, i64 0
%161 = load i32, i32* %6
%162 = load i32, i32* %7
%163 = load i64, i64* %14
%164 = call i32 @add_verdb(i8* %160, i32 %161, i32 %162, i64 %163)
br label %23
165: ; preds = %23
%166 = load i32*, i32** %3
%167 = call i64 @ferror(i32* %166)
%168 = icmp ne i64 %167, 0
br i1 %168, label %169, label %174
169: ; preds = %165
%170 = load i32, i32* @stderr
%171 = load i8*, i8** %2
%172 = call i32 @fprintf(i32 %170, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %171)
%173 = call i32 @exit(i32 1)
unreachable
174: ; preds = %165
%175 = load i32*, i32** %3
%176 = call i32 @fclose(i32* %175)
br label %177
177: ; preds = %174, %18
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"cannot open database file '%s'\0A\00"
@.str.2 = [19 x i8] c"%s: line too long\0A\00"
@.str.3 = [20 x i8] c"%d %s %d %d/%d/%d%n\00"
@.str.4 = [18 x i8] c"%s: line invalid\0A\00"
@.str.5 = [35 x i8] c"%s: time specification is invalid\0A\00"
@.str.6 = [11 x i8] c"%d %s %d%n\00"
@.str.7 = [16 x i8] c"%s: read error\0A\00"
define void @read_verdb(i8* %0) {
%2 = alloca [78 x i8]
%3 = alloca [78 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.tm
%11 = getelementptr inbounds [78 x i8], [78 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [78 x i8], [78 x i8]* %3, i64 0, i64 0
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast i32* %8 to i8*
%18 = bitcast i32* %9 to i8*
%19 = bitcast %struct.tm* %10 to i8*
%20 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %31, label %22
22: ; preds = %1
%23 = call i64 @fgets(i8* %11, i32 78, i32* %20)
%24 = icmp eq i64 %23, 0
br i1 %24, label %138, label %25
25: ; preds = %22
%26 = getelementptr inbounds [78 x i8], [78 x i8]* %2, i64 0, i64 76
%27 = getelementptr inbounds %struct.tm, %struct.tm* %10, i64 0, i32 0
%28 = getelementptr inbounds %struct.tm, %struct.tm* %10, i64 0, i32 1
%29 = getelementptr inbounds %struct.tm, %struct.tm* %10, i64 0, i32 2
%30 = getelementptr inbounds %struct.tm, %struct.tm* %10, i64 0, i32 3
br label %34
31: ; preds = %1
%32 = load i32, i32* @stderr
%33 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %147
34: ; preds = %25, %135
%35 = call i32 @strlen(i8* %11)
%36 = icmp ugt i32 %35, 76
%37 = load i8, i8* %26
%38 = icmp ne i8 %37, 10
%39 = select i1 %36, i1 %38, i1 false
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %34
%45 = load i8, i8* %11
switch i8 %45, label %46 [
i8 35, label %135
i8 10, label %135
]
46: ; preds = %44
%47 = call i32 @strlen(i8* %11)
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %61
49: ; preds = %46
%50 = zext i32 %47 to i64
br label %51
51: ; preds = %49, %59
%52 = phi i64 [ %50, %49 ], [ %53, %59 ]
%53 = add nsw i64 %52, -1
%54 = and i64 %53, 4294967295
%55 = getelementptr inbounds [78 x i8], [78 x i8]* %2, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = call i64 @isspace(i8 signext %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %51
store i8 0, i8* %55
%60 = icmp ugt i64 %52, 1
br i1 %60, label %51, label %61
61: ; preds = %51, %59, %46
%62 = call i32 (i8*, i8*, i32*, i8*, i32*, i32*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32* %5, i8* %12, i32* %4, i32* %7, i32* %8, i32* %9, i32* %6)
%63 = icmp eq i32 %62, 6
br i1 %63, label %64, label %111
64: ; preds = %61
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [78 x i8], [78 x i8]* %2, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = icmp eq i8 %68, 0
br i1 %69, label %70, label %111
70: ; preds = %64
%71 = load i32, i32* %4
%72 = icmp slt i32 %71, 0
%73 = load i32, i32* %5
%74 = icmp slt i32 %73, 0
%75 = select i1 %72, i1 true, i1 %74
%76 = load i32, i32* %7
%77 = icmp slt i32 %76, 1970
%78 = select i1 %75, i1 true, i1 %77
%79 = icmp sgt i32 %76, 2040
%80 = select i1 %78, i1 true, i1 %79
%81 = load i32, i32* %8
%82 = icmp slt i32 %81, 1
%83 = select i1 %80, i1 true, i1 %82
%84 = icmp sgt i32 %81, 12
%85 = select i1 %83, i1 true, i1 %84
%86 = load i32, i32* %9
%87 = icmp slt i32 %86, 1
%88 = select i1 %85, i1 true, i1 %87
%89 = icmp sgt i32 %86, 31
%90 = select i1 %88, i1 true, i1 %89
br i1 %90, label %91, label %95
91: ; preds = %70
%92 = load i32, i32* @stderr
%93 = call i32 @fprintf(i32 %92, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %70
%96 = call i32 @memset(%struct.tm* %10, i32 0, i32 16)
store i32 -1, i32* %27
%97 = load i32, i32* %7
%98 = add nsw i32 %97, -1900
store i32 %98, i32* %28
%99 = load i32, i32* %8
%100 = add nsw i32 %99, -1
store i32 %100, i32* %29
%101 = load i32, i32* %9
store i32 %101, i32* %30
%102 = call i64 @mktime(%struct.tm* %10)
%103 = icmp eq i64 %102, -1
br i1 %103, label %107, label %104
104: ; preds = %95
%105 = load i32, i32* %4
%106 = load i32, i32* %5
br label %130
107: ; preds = %95
%108 = load i32, i32* @stderr
%109 = call i32 @fprintf(i32 %108, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %64, %61
%112 = call i32 (i8*, i8*, i32*, i8*, i32*, i32*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32* %5, i8* %12, i32* %4, i32* %6)
%113 = icmp eq i32 %112, 3
br i1 %113, label %114, label %126
114: ; preds = %111
%115 = load i32, i32* %6
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [78 x i8], [78 x i8]* %2, i64 0, i64 %116
%118 = load i8, i8* %117
%119 = icmp ne i8 %118, 0
%120 = load i32, i32* %4
%121 = icmp slt i32 %120, 0
%122 = select i1 %119, i1 true, i1 %121
%123 = load i32, i32* %5
%124 = icmp slt i32 %123, 0
%125 = select i1 %122, i1 true, i1 %124
br i1 %125, label %126, label %130
126: ; preds = %114, %111
%127 = load i32, i32* @stderr
%128 = call i32 @fprintf(i32 %127, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %104, %114
%131 = phi i32 [ %123, %114 ], [ %106, %104 ]
%132 = phi i32 [ %120, %114 ], [ %105, %104 ]
%133 = phi i64 [ 0, %114 ], [ %102, %104 ]
%134 = call i32 @add_verdb(i8* %12, i32 %132, i32 %131, i64 %133)
br label %135
135: ; preds = %130, %44, %44
%136 = call i64 @fgets(i8* %11, i32 78, i32* %20)
%137 = icmp eq i64 %136, 0
br i1 %137, label %138, label %34
138: ; preds = %135, %22
%139 = call i64 @ferror(i32* %20)
%140 = icmp eq i64 %139, 0
br i1 %140, label %145, label %141
141: ; preds = %138
%142 = load i32, i32* @stderr
%143 = call i32 @fprintf(i32 %142, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* %0)
%144 = call i32 @exit(i32 1)
unreachable
145: ; preds = %138
%146 = call i32 @fclose(i32* %20)
br label %147
147: ; preds = %145, %31
ret void
}