#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*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ mjd(int *);
int sscanf(char *, char *, int *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ strcasecmp(char *, char const *);
int strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char const *, int);
int /*<<< orphan*/ timeofday(int *);
int txt2utc(char *txt, uint32_t utc[2]) {
  const char *months[] = {"january",   "february", "march",    "april",
                          "may",       "june",     "july",     "august",
                          "september", "october",  "november", "december"};
  int date_parts[3];
  int time_parts[3];
  char month_name[10];
  int i, l, n;
  if (txt == NULL)
    return -1;
  ;
  n = sscanf(txt, "%d-%9[A-Za-z]-%d:%d:%d:%d", &(date_parts[0]), month_name,
             &(date_parts[2]), &(time_parts[0]), &(time_parts[1]),
             &(time_parts[2]));
  ;
  if (n < 3) {
    return -1;
  }
  if (n < 4)
    time_parts[0] = 0;
  if (n < 5)
    time_parts[1] = 0;
  if (n < 6)
    time_parts[2] = 0;
  l = strlen(month_name);
  date_parts[1] = -1;
  for (i = 0; i < 12; i++) {
    if (!strcasecmp(month_name, months[i])) {
      date_parts[1] = i + 1;
      break;
    }
    if ((l == 3) && (!strncasecmp(month_name, months[i], 3))) {
      date_parts[1] = i + 1;
      break;
    }
  }
  if (date_parts[1] == -1)
    return -1;
  if (date_parts[0] < 1900) {
    int tmp = date_parts[0];
    date_parts[0] = date_parts[2];
    date_parts[2] = tmp;
  }
  utc[0] = mjd(date_parts);
  utc[1] = timeofday(time_parts);
  return 0;
}


x86 assembly (clang, -O0):
<txt2utc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c32(%rip),%rsi
mov    $0x60,%edx
call   1070 <memcpy@plt>
cmpq   $0x0,-0x10(%rbp)
jne    11af <txt2utc+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    13a7 <txt2utc+0x237>
mov    -0x10(%rbp),%rdi
lea    -0x8c(%rbp),%rdx
lea    -0xa2(%rbp),%rcx
lea    -0x8c(%rbp),%r8
add    $0x8,%r8
lea    -0x98(%rbp),%r9
lea    -0x98(%rbp),%r10
add    $0x4,%r10
lea    -0x98(%rbp),%rax
add    $0x8,%rax
lea    0xe66(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1090 <sscanf@plt>
mov    %eax,-0xb0(%rbp)
cmpl   $0x3,-0xb0(%rbp)
jge    121d <txt2utc+0xad>
movl   $0xffffffff,-0x4(%rbp)
jmp    13a7 <txt2utc+0x237>
cmpl   $0x4,-0xb0(%rbp)
jge    1234 <txt2utc+0xc4>
movl   $0x0,-0x98(%rbp)
cmpl   $0x5,-0xb0(%rbp)
jge    124b <txt2utc+0xdb>
movl   $0x0,-0x94(%rbp)
cmpl   $0x6,-0xb0(%rbp)
jge    1262 <txt2utc+0xf2>
movl   $0x0,-0x90(%rbp)
lea    -0xa2(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0xac(%rbp)
movl   $0xffffffff,-0x88(%rbp)
ff ff ff
movl   $0x0,-0xa8(%rbp)
cmpl   $0xc,-0xa8(%rbp)
jge    132a <txt2utc+0x1ba>
lea    -0xa2(%rbp),%rdi
movslq -0xa8(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12ca <txt2utc+0x15a>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    132a <txt2utc+0x1ba>
cmpl   $0x3,-0xac(%rbp)
jne    1311 <txt2utc+0x1a1>
lea    -0xa2(%rbp),%rdi
movslq -0xa8(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
mov    $0x3,%edx
call   1080 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1311 <txt2utc+0x1a1>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    132a <txt2utc+0x1ba>
jmp    1316 <txt2utc+0x1a6>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    1288 <txt2utc+0x118>
cmpl   $0xffffffff,-0x88(%rbp)
jne    1343 <txt2utc+0x1d3>
movl   $0xffffffff,-0x4(%rbp)
jmp    13a7 <txt2utc+0x237>
cmpl   $0x76c,-0x8c(%rbp)
jge    1377 <txt2utc+0x207>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0x84(%rbp)
lea    -0x8c(%rbp),%rdi
call   1040 <mjd@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x98(%rbp),%rdi
call   1050 <timeofday@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txt2utc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     129c <txt2utc+0x13c>
mov    %rsi,%rbx
lea    0x10(%rsp),%r8
lea    0x18(%rsp),%r10
lea    0x1c(%rsp),%rax
lea    0xec1(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x2e(%rsp),%rcx
lea    0x14(%rsp),%r9
push   %rax
push   %r10
call   1080 <sscanf@plt>
add    $0x10,%rsp
cmp    $0x3,%eax
jl     129c <txt2utc+0x13c>
mov    %rbx,0x20(%rsp)
jne    11d2 <txt2utc+0x72>
movl   $0x0,0x14(%rsp)
movl   $0x0,0x18(%rsp)
jmp    11e6 <txt2utc+0x86>
cmp    $0x4,%eax
ja     11e1 <txt2utc+0x81>
movl   $0x0,0x18(%rsp)
jmp    11e6 <txt2utc+0x86>
cmp    $0x5,%eax
jne    11ee <txt2utc+0x8e>
movl   $0x0,0x1c(%rsp)
lea    0x2e(%rsp),%r12
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,%r13d
movl   $0xffffffff,0xc(%rsp)
ff
mov    $0x1,%ebp
xor    %r14d,%r14d
lea    0x2bab(%rip),%r15
jmp    122d <txt2utc+0xcd>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
add    $0x8,%r14
cmp    $0x60,%r14
je     1297 <txt2utc+0x137>
mov    (%r14,%r15,1),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125a <txt2utc+0xfa>
cmp    $0x3,%r13d
jne    1220 <txt2utc+0xc0>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1070 <strncasecmp@plt>
test   %eax,%eax
jne    1220 <txt2utc+0xc0>
mov    %ebp,0xc(%rsp)
mov    0x8(%rsp),%eax
cmp    $0x76b,%eax
jg     1275 <txt2utc+0x115>
mov    0x10(%rsp),%ecx
mov    %ecx,0x8(%rsp)
mov    %eax,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <mjd@plt>
mov    0x20(%rsp),%rbx
mov    %eax,(%rbx)
lea    0x14(%rsp),%rdi
call   1050 <timeofday@plt>
mov    %eax,0x4(%rbx)
xor    %ebp,%ebp
jmp    129c <txt2utc+0x13c>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"january\00"
@.str.1 = [9 x i8] c"february\00"
@.str.2 = [6 x i8] c"march\00"
@.str.3 = [6 x i8] c"april\00"
@.str.4 = [4 x i8] c"may\00"
@.str.5 = [5 x i8] c"june\00"
@.str.6 = [5 x i8] c"july\00"
@.str.7 = [7 x i8] c"august\00"
@.str.8 = [10 x i8] c"september\00"
@.str.9 = [8 x i8] c"october\00"
@.str.10 = [9 x i8] c"november\00"
@.str.11 = [9 x i8] c"december\00"
@__const.txt2utc.months = [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [26 x i8] c"%d-%9[A-Za-z]-%d:%d:%d:%d\00"
define i32 @txt2utc(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [12 x i8*]
%7 = alloca [3 x i32]
%8 = alloca [3 x i32]
%9 = alloca [10 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%14 = bitcast [12 x i8*]* %6 to i8*
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %109
18: ; preds = %2
%19 = load i8*, i8** %4
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
%26 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32* %20, i8* %21, i32* %22, i32* %23, i32* %24, i32* %25)
store i32 %26, i32* %12
%27 = load i32, i32* %12
%28 = icmp slt i32 %27, 3
br i1 %28, label %29, label %30
29: ; preds = %18
store i32 -1, i32* %3
br label %109
30: ; preds = %18
%31 = load i32, i32* %12
%32 = icmp slt i32 %31, 4
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
store i32 0, i32* %34
br label %35
35: ; preds = %33, %30
%36 = load i32, i32* %12
%37 = icmp slt i32 %36, 5
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
store i32 0, i32* %39
br label %40
40: ; preds = %38, %35
%41 = load i32, i32* %12
%42 = icmp slt i32 %41, 6
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
store i32 0, i32* %44
br label %45
45: ; preds = %43, %40
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%47 = call i32 @strlen(i8* %46)
store i32 %47, i32* %11
%48 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 -1, i32* %48
store i32 0, i32* %10
br label %49
49: ; preds = %80, %45
%50 = load i32, i32* %10
%51 = icmp slt i32 %50, 12
br i1 %51, label %52, label %83
52: ; preds = %49
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [12 x i8*], [12 x i8*]* %6, i64 0, i64 %55
%57 = load i8*, i8** %56
%58 = call i32 @strcasecmp(i8* %53, i8* %57)
%59 = icmp ne i32 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %52
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %62, i32* %63
br label %83
64: ; preds = %52
%65 = load i32, i32* %11
%66 = icmp eq i32 %65, 3
br i1 %66, label %67, label %79
67: ; preds = %64
%68 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%69 = load i32, i32* %10
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [12 x i8*], [12 x i8*]* %6, i64 0, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 @strncasecmp(i8* %68, i8* %72, i32 3)
%74 = icmp ne i32 %73, 0
br i1 %74, label %79, label %75
75: ; preds = %67
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
%78 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %77, i32* %78
br label %83
79: ; preds = %67, %64
br label %80
80: ; preds = %79
%81 = load i32, i32* %10
%82 = add nsw i32 %81, 1
store i32 %82, i32* %10
br label %49
83: ; preds = %75, %60, %49
%84 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
%85 = load i32, i32* %84
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %88
87: ; preds = %83
store i32 -1, i32* %3
br label %109
88: ; preds = %83
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%90 = load i32, i32* %89
%91 = icmp slt i32 %90, 1900
br i1 %91, label %92, label %100
92: ; preds = %88
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%94 = load i32, i32* %93
store i32 %94, i32* %13
%95 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
%96 = load i32, i32* %95
%97 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %96, i32* %97
%98 = load i32, i32* %13
%99 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 %98, i32* %99
br label %100
100: ; preds = %92, %88
%101 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%102 = call i32 @mjd(i32* %101)
%103 = load i32*, i32** %5
%104 = getelementptr inbounds i32, i32* %103, i64 0
store i32 %102, i32* %104
%105 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%106 = call i32 @timeofday(i32* %105)
%107 = load i32*, i32** %5
%108 = getelementptr inbounds i32, i32* %107, i64 1
store i32 %106, i32* %108
store i32 0, i32* %3
br label %109
109: ; preds = %100, %87, %29, %17
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str = [8 x i8] c"january\00"
@.str.1 = [9 x i8] c"february\00"
@.str.2 = [6 x i8] c"march\00"
@.str.3 = [6 x i8] c"april\00"
@.str.4 = [4 x i8] c"may\00"
@.str.5 = [5 x i8] c"june\00"
@.str.6 = [5 x i8] c"july\00"
@.str.7 = [7 x i8] c"august\00"
@.str.8 = [10 x i8] c"september\00"
@.str.9 = [8 x i8] c"october\00"
@.str.10 = [9 x i8] c"november\00"
@.str.11 = [9 x i8] c"december\00"
@__const.txt2utc.months = [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [26 x i8] c"%d-%9[A-Za-z]-%d:%d:%d:%d\00"
define i32 @txt2utc(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = alloca [10 x i8]
%6 = bitcast [3 x i32]* %3 to i8*
%7 = bitcast [3 x i32]* %4 to i8*
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = icmp eq i8* %0, null
br i1 %9, label %55, label %10
10: ; preds = %2
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%16 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i32* %11, i8* %8, i32* %12, i32* %13, i32* %14, i32* %15)
%17 = icmp slt i32 %16, 3
br i1 %17, label %55, label %18
18: ; preds = %10
%19 = icmp eq i32 %16, 3
br i1 %19, label %20, label %21
20: ; preds = %18
store i32 0, i32* %13
br label %23
21: ; preds = %18
%22 = icmp ult i32 %16, 5
br i1 %22, label %23, label %24
23: ; preds = %21, %20
store i32 0, i32* %14
br label %26
24: ; preds = %21
%25 = icmp eq i32 %16, 5
br i1 %25, label %26, label %27
26: ; preds = %23, %24
store i32 0, i32* %15
br label %27
27: ; preds = %26, %24
%28 = call i32 @strlen(i8* %8)
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store i32 -1, i32* %29
%30 = icmp eq i32 %28, 3
br label %31
31: ; preds = %27, %41
%32 = phi i64 [ 0, %27 ], [ %42, %41 ]
%33 = getelementptr inbounds [12 x i8*], [12 x i8*]* @__const.txt2utc.months, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @strcasecmp(i8* %8, i8* %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %44, label %37
37: ; preds = %31
br i1 %30, label %38, label %41
38: ; preds = %37
%39 = call i32 @strncasecmp(i8* %8, i8* %34, i32 3)
%40 = icmp eq i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %37, %38
%42 = add nuw nsw i64 %32, 1
%43 = icmp eq i64 %42, 12
br i1 %43, label %55, label %31
44: ; preds = %38, %31
%45 = trunc i64 %32 to i32
%46 = add nuw nsw i32 %45, 1
store i32 %46, i32* %29
%47 = load i32, i32* %11
%48 = icmp slt i32 %47, 1900
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = load i32, i32* %12
store i32 %50, i32* %11
store i32 %47, i32* %12
br label %51
51: ; preds = %49, %44
%52 = call i32 @mjd(i32* %11)
store i32 %52, i32* %1
%53 = call i32 @timeofday(i32* %13)
%54 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %53, i32* %54
br label %55
55: ; preds = %41, %10, %2, %51
%56 = phi i32 [ 0, %51 ], [ -1, %2 ], [ -1, %10 ], [ -1, %41 ]
ret i32 %56
}