#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 */
struct tm {
  int tm_wday;
  int tm_year;
  int tm_mon;
  int tm_isdst;
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
};

/* Variables and functions */
int sscanf(char *, char *, int *, int *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int Exif2tm(struct tm *timeptr, char *ExifTime) {
  int a;
  timeptr->tm_wday = -1;
  a = sscanf(ExifTime, "%d:%d:%d %d:%d:%d", &timeptr->tm_year, &timeptr->tm_mon,
             &timeptr->tm_mday, &timeptr->tm_hour, &timeptr->tm_min,
             &timeptr->tm_sec);
  if (a == 6) {
    timeptr->tm_isdst = -1;
    timeptr->tm_mon -= 1;
    timeptr->tm_year -= 1900;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Exif2tm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
add    $0x4,%rdx
mov    -0x10(%rbp),%rcx
add    $0x8,%rcx
mov    -0x10(%rbp),%r8
add    $0x1c,%r8
mov    -0x10(%rbp),%r9
add    $0x18,%r9
mov    -0x10(%rbp),%r10
add    $0x14,%r10
mov    -0x10(%rbp),%rax
add    $0x10,%rax
lea    0xe9b(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <sscanf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jne    11b4 <Exif2tm+0xa4>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,0xc(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
sub    $0x76c,%ecx
mov    %ecx,0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11bb <Exif2tm+0xab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exif2tm>:
push   %rbx
mov    %rsi,%r11
mov    %rdi,%rbx
movl   $0xffffffff,(%rdi)
lea    0x4(%rdi),%rdx
lea    0x8(%rdi),%rcx
lea    0x1c(%rdi),%r8
lea    0x18(%rdi),%r9
lea    0x14(%rdi),%r10
lea    0x10(%rdi),%rax
lea    0xec4(%rip),%rsi
mov    %r11,%rdi
push   %rax
push   %r10
call   1030 <sscanf@plt>
add    $0x10,%rsp
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
jne    116b <Exif2tm+0x5b>
movl   $0xffffffff,0xc(%rbx)
addl   $0xffffffff,0x8(%rbx)
addl   $0xfffff894,0x4(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [18 x i8] c"%d:%d:%d %d:%d:%d\00"
define i32 @Exif2tm(%struct.tm* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca i8*
%6 = alloca i32
store %struct.tm* %0, %struct.tm** %4
store i8* %1, i8** %5
%7 = load %struct.tm*, %struct.tm** %4
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
store i32 -1, i32* %8
%9 = load i8*, i8** %5
%10 = load %struct.tm*, %struct.tm** %4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 1
%12 = load %struct.tm*, %struct.tm** %4
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 2
%14 = load %struct.tm*, %struct.tm** %4
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 7
%16 = load %struct.tm*, %struct.tm** %4
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 6
%18 = load %struct.tm*, %struct.tm** %4
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 5
%20 = load %struct.tm*, %struct.tm** %4
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 4
%22 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %11, i32* %13, i32* %15, i32* %17, i32* %19, i32* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 6
br i1 %24, label %25, label %36
25: ; preds = %2
%26 = load %struct.tm*, %struct.tm** %4
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 3
store i32 -1, i32* %27
%28 = load %struct.tm*, %struct.tm** %4
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 2
%30 = load i32, i32* %29
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %29
%32 = load %struct.tm*, %struct.tm** %4
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 1
%34 = load i32, i32* %33
%35 = sub nsw i32 %34, 1900
store i32 %35, i32* %33
store i32 1, i32* %3
br label %37
36: ; preds = %2
store i32 0, i32* %3
br label %37
37: ; preds = %36, %25
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [18 x i8] c"%d:%d:%d %d:%d:%d\00"
define i32 @Exif2tm(%struct.tm* %0, i8* nocapture %1) {
%3 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
store i32 -1, i32* %3
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%5 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 7
%7 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 4
%10 = tail call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9)
%11 = icmp eq i32 %10, 6
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 3
store i32 -1, i32* %13
%14 = load i32, i32* %5
%15 = add nsw i32 %14, -1
store i32 %15, i32* %5
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1900
store i32 %17, i32* %4
br label %18
18: ; preds = %2, %12
%19 = phi i32 [ 1, %12 ], [ 0, %2 ]
ret i32 %19
}