#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(unsigned char *, unsigned char *, int, scalar_t__);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
scalar_t__ fgets(unsigned char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(unsigned char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned char const *);
scalar_t__ isspace(unsigned char);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
scalar_t__ mktime(struct tm *);
int sscanf(unsigned char *, char *, unsigned char *, unsigned char *, int *,
           int *, ...);
int /*<<< orphan*/ stderr;
int strlen(unsigned char *);
void read_verdb(unsigned char const *name) {
  FILE *f;
  unsigned char buf[1024];
  unsigned char version[sizeof(buf)];
  unsigned char id[sizeof(buf)];
  int patch, 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);
    exit(1);
  }
  while (fgets(buf, sizeof(buf), f)) {
    buflen = strlen(buf);
    if (buflen == sizeof(buf) - 1 && buf[buflen - 1] != '\n') {
      fprintf(stderr, "%s: line too long\n", name);
      exit(1);
    }
    if (buf[0] == '#')
      continue;
    if (buf[0] == '\n')
      continue;
    while (buflen > 0 && isspace(buf[buflen - 1]))
      buf[--buflen] = 0;
    tt = 0;
    if (sscanf(buf, "%s %s %d %d/%d/%d%n", id, version, &patch, &year, &month,
               &mday, &n) == 6 &&
        !buf[n]) {
      if (patch < 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, "%s %s %d%n", id, version, &patch, &n) != 3 ||
               buf[n] || patch < 0) {
      fprintf(stderr, "%s: line invalid\n", name);
      exit(1);
    }
    add_verdb(id, version, patch, 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    $0xc60,%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    1210 <read_verdb+0x50>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe01(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1215 <read_verdb+0x55>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     156d <read_verdb+0x3ad>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc1c(%rbp)
movslq -0xc1c(%rbp),%rax
cmp    $0x3ff,%rax
jne    1298 <read_verdb+0xd8>
mov    -0xc1c(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     1298 <read_verdb+0xd8>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd99(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movzbl -0x410(%rbp),%eax
cmp    $0x23,%eax
jne    12ad <read_verdb+0xed>
jmp    1215 <read_verdb+0x55>
movzbl -0x410(%rbp),%eax
cmp    $0xa,%eax
jne    12c2 <read_verdb+0x102>
jmp    1215 <read_verdb+0x55>
jmp    12c7 <read_verdb+0x107>
xor    %eax,%eax
cmpl   $0x0,-0xc1c(%rbp)
mov    %al,-0xc41(%rbp)
jle    1301 <read_verdb+0x141>
mov    -0xc1c(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x410(%rbp,%rax,1),%edi
ff
call   1070 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xc41(%rbp)
mov    -0xc41(%rbp),%al
test   $0x1,%al
jne    1314 <read_verdb+0x154>
jmp    1332 <read_verdb+0x172>
mov    -0xc1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc1c(%rbp)
cltq
movb   $0x0,-0x410(%rbp,%rax,1)
jmp    12c7 <read_verdb+0x107>
movq   $0x0,-0xc40(%rbp)
lea    -0x410(%rbp),%rdi
lea    -0xc10(%rbp),%rdx
lea    -0x810(%rbp),%rcx
lea    0xcdc(%rip),%rsi
lea    -0xc14(%rbp),%r8
lea    -0xc20(%rbp),%r9
lea    -0xc24(%rbp),%r11
lea    -0xc28(%rbp),%r10
lea    -0xc18(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x6,%eax
jne    14c1 <read_verdb+0x301>
movslq -0xc18(%rbp),%rax
cmpb   $0x0,-0x410(%rbp,%rax,1)
jne    14c1 <read_verdb+0x301>
cmpl   $0x0,-0xc14(%rbp)
jl     1410 <read_verdb+0x250>
cmpl   $0x7b2,-0xc20(%rbp)
jl     1410 <read_verdb+0x250>
cmpl   $0x7f8,-0xc20(%rbp)
jg     1410 <read_verdb+0x250>
cmpl   $0x1,-0xc24(%rbp)
jl     1410 <read_verdb+0x250>
cmpl   $0xc,-0xc24(%rbp)
jg     1410 <read_verdb+0x250>
cmpl   $0x1,-0xc28(%rbp)
jl     1410 <read_verdb+0x250>
cmpl   $0x1f,-0xc28(%rbp)
jle    1433 <read_verdb+0x273>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xc25(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0xc38(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0xffffffff,-0xc38(%rbp)
ff ff ff
mov    -0xc20(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0xc34(%rbp)
mov    -0xc24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc30(%rbp)
mov    -0xc28(%rbp),%eax
mov    %eax,-0xc2c(%rbp)
lea    -0xc38(%rbp),%rdi
call   10b0 <mktime@plt>
mov    %rax,-0xc40(%rbp)
cmp    $0xffffffffffffffff,%rax
jne    14bc <read_verdb+0x2fc>
mov    0x2b40(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xbae(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1548 <read_verdb+0x388>
lea    -0x410(%rbp),%rdi
lea    -0xc10(%rbp),%rdx
lea    -0x810(%rbp),%rcx
lea    0xba1(%rip),%rsi
lea    -0xc14(%rbp),%r8
lea    -0xc18(%rbp),%r9
mov    $0x0,%al
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
jne    1520 <read_verdb+0x360>
movslq -0xc18(%rbp),%rax
movzbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    1520 <read_verdb+0x360>
cmpl   $0x0,-0xc14(%rbp)
jge    1543 <read_verdb+0x383>
mov    0x2ab9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xb15(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1548 <read_verdb+0x388>
lea    -0xc10(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    -0xc14(%rbp),%edx
mov    -0xc40(%rbp),%rcx
call   10d0 <add_verdb@plt>
jmp    1215 <read_verdb+0x55>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     15a3 <read_verdb+0x3e3>
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xaf5(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0xc60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_verdb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc38,%rsp
lea    0xe28(%rip),%rsi
mov    %rdi,0x8(%rsp)
call   10c0 <fopen@plt>
test   %rax,%rax
je     1458 <read_verdb+0x298>
mov    %rax,%r15
lea    0x30(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13e9 <read_verdb+0x229>
lea    0x30(%rsp),%r14
lea    0x430(%rsp),%rbp
lea    0x830(%rsp),%rbx
jmp    1244 <read_verdb+0x84>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10d0 <add_verdb@plt>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13e9 <read_verdb+0x229>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x3ff,%eax
jne    1261 <read_verdb+0xa1>
cmpb   $0xa,0x42e(%rsp)
0a
jne    1410 <read_verdb+0x250>
mov    0x30(%rsp),%cl
cmp    $0xa,%cl
je     122b <read_verdb+0x6b>
cmp    $0x23,%cl
je     122b <read_verdb+0x6b>
test   %eax,%eax
jle    12a5 <read_verdb+0xe5>
mov    %eax,%r12d
add    $0x1,%r12
nopw   0x0(%rax,%rax,1)
lea    -0x2(%r12),%r13d
movzbl 0x30(%rsp,%r13,1),%edi
call   1070 <isspace@plt>
test   %rax,%rax
je     12a5 <read_verdb+0xe5>
movb   $0x0,0x30(%rsp,%r13,1)
add    $0xffffffffffffffff,%r12
cmp    $0x1,%r12
ja     1280 <read_verdb+0xc0>
sub    $0x8,%rsp
mov    %r14,%rdi
lea    0xd82(%rip),%rsi
mov    %rbp,%r12
mov    %rbp,%rdx
mov    %rbx,%rcx
lea    0x8(%rsp),%r8
lea    0x24(%rsp),%r9
xor    %eax,%eax
lea    0xc(%rsp),%rbp
push   %rbp
lea    0x24(%rsp),%rbp
push   %rbp
lea    0x30(%rsp),%rbp
push   %rbp
call   10a0 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x6,%eax
jne    12f4 <read_verdb+0x134>
movslq 0x4(%rsp),%rax
cmpb   $0x0,0x30(%rsp,%rax,1)
je     1341 <read_verdb+0x181>
mov    %r14,%rdi
lea    0xd80(%rip),%rsi
mov    %r12,%rbp
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %rsp,%r8
lea    0x4(%rsp),%r9
xor    %eax,%eax
call   10a0 <sscanf@plt>
cmp    $0x3,%eax
jne    1422 <read_verdb+0x262>
movslq 0x4(%rsp),%rax
cmpb   $0x0,0x30(%rsp,%rax,1)
jne    1422 <read_verdb+0x262>
mov    (%rsp),%edx
test   %edx,%edx
js     1422 <read_verdb+0x262>
xor    %ecx,%ecx
jmp    1220 <read_verdb+0x60>
cmpl   $0x0,(%rsp)
js     1422 <read_verdb+0x262>
mov    0x1c(%rsp),%eax
cmp    $0x7b2,%eax
jl     1422 <read_verdb+0x262>
cmp    $0x7f8,%eax
jg     1422 <read_verdb+0x262>
mov    0x18(%rsp),%eax
test   %eax,%eax
jle    1422 <read_verdb+0x262>
cmp    $0xc,%eax
jg     1422 <read_verdb+0x262>
mov    0x14(%rsp),%eax
test   %eax,%eax
jle    1422 <read_verdb+0x262>
cmp    $0x20,%eax
jge    1422 <read_verdb+0x262>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0xffffffff,0x20(%rsp)
ff
mov    0x1c(%rsp),%eax
mov    $0xfffff894,%ecx
add    %ecx,%eax
mov    %eax,0x24(%rsp)
mov    0x18(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x28(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x2c(%rsp)
mov    %rbp,%rdi
call   10b0 <mktime@plt>
cmp    $0xffffffffffffffff,%rax
je     1446 <read_verdb+0x286>
mov    %rax,%rcx
mov    %r12,%rbp
mov    (%rsp),%edx
jmp    1220 <read_verdb+0x60>
mov    %r15,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    146a <read_verdb+0x2aa>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0xc38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    0xc02(%rip),%rsi
jmp    1432 <read_verdb+0x272>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
lea    0xc17(%rip),%rsi
mov    0x8(%rsp),%rdx
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
lea    0xc05(%rip),%rsi
jmp    1432 <read_verdb+0x272>
mov    0x2b81(%rip),%rax
mov    (%rax),%edi
lea    0xb9a(%rip),%rsi
jmp    1432 <read_verdb+0x272>
mov    0x2b6f(%rip),%rax
mov    (%rax),%edi
lea    0xc0f(%rip),%rsi
jmp    1432 <read_verdb+0x272>

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