#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 *, int *, int *, int *, int *, int *);
int /*<<< orphan*/ timeofday(int *);
int fname2utc(char *fname, uint32_t utc[2]) {
  int date_parts[3];
  int time_parts[3];
  int n;
  n = sscanf(fname, "%4d%2d%2d_%2d%2d%2d", &(date_parts[0]), &(date_parts[1]),
             &(date_parts[2]), &(time_parts[0]), &(time_parts[1]),
             &(time_parts[2]));
  if (n < 6) {
    return -1;
  }
  utc[0] = mjd(date_parts);
  utc[1] = timeofday(time_parts);
  return 0;
}


x86 assembly (clang, -O0):
<fname2utc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rdx
lea    -0x24(%rbp),%rcx
add    $0x4,%rcx
lea    -0x24(%rbp),%r8
add    $0x8,%r8
lea    -0x30(%rbp),%r9
lea    -0x30(%rbp),%r10
add    $0x4,%r10
lea    -0x30(%rbp),%rax
add    $0x8,%rax
lea    0xe8d(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <sscanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x6,-0x34(%rbp)
jge    119a <fname2utc+0x6a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c4 <fname2utc+0x94>
lea    -0x24(%rbp),%rdi
call   1030 <mjd@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x30(%rbp),%rdi
call   1040 <timeofday@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fname2utc>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
lea    0x18(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0xc(%rsp),%r10
lea    0x10(%rsp),%rax
lea    0xead(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%r9
push   %rax
push   %r10
call   1050 <sscanf@plt>
add    $0x10,%rsp
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x6,%ecx
jl     1190 <fname2utc+0x60>
lea    0x14(%rsp),%rdi
call   1030 <mjd@plt>
mov    %eax,(%rbx)
lea    0x8(%rsp),%rdi
call   1040 <timeofday@plt>
mov    %eax,0x4(%rbx)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%4d%2d%2d_%2d%2d%2d\00"
define i32 @fname2utc(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [3 x i32]
%7 = alloca [3 x i32]
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%9 = load i8*, i8** %4
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 2
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
%16 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32* %15)
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 6
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 -1, i32* %3
br label %29
20: ; preds = %2
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%22 = call i32 @mjd(i32* %21)
%23 = load i32*, i32** %5
%24 = getelementptr inbounds i32, i32* %23, i64 0
store i32 %22, i32* %24
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%26 = call i32 @timeofday(i32* %25)
%27 = load i32*, i32** %5
%28 = getelementptr inbounds i32, i32* %27, i64 1
store i32 %26, i32* %28
store i32 0, i32* %3
br label %29
29: ; preds = %20, %19
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [20 x i8] c"%4d%2d%2d_%2d%2d%2d\00"
define i32 @fname2utc(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = bitcast [3 x i32]* %3 to i8*
%6 = bitcast [3 x i32]* %4 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%13 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12)
%14 = icmp slt i32 %13, 6
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = call i32 @mjd(i32* %7)
store i32 %16, i32* %1
%17 = call i32 @timeofday(i32* %10)
%18 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %17, i32* %18
br label %19
19: ; preds = %2, %15
%20 = phi i32 [ 0, %15 ], [ -1, %2 ]
ret i32 %20
}