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

/* Variables and functions */
int /*<<< orphan*/ gmmktime(struct tm *);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sscanf(char const *, char *, int *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
time_t parse_xml_time(const char *t) {
  struct tm tm;
  memset(&tm, 0, sizeof(tm));
  sscanf(t, "%04d-%02d-%02dT%02d:%02d:%02d", &tm.tm_year, &tm.tm_mon,
         &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
  tm.tm_year -= 1900;
  tm.tm_mon--;
  return gmmktime(&tm);
}


x86 assembly (clang, -O0):
<parse_xml_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x20(%rbp),%rcx
add    $0x4,%rcx
lea    -0x20(%rbp),%r8
add    $0x14,%r8
lea    -0x20(%rbp),%r9
add    $0x10,%r9
lea    -0x20(%rbp),%r10
add    $0xc,%r10
lea    -0x20(%rbp),%rax
add    $0x8,%rax
lea    0xe7d(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <sscanf@plt>
mov    -0x20(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <gmmktime@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_xml_time>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
lea    0x4(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
lea    0xc(%rsp),%r10
lea    0x8(%rsp),%rax
lea    0xe94(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
push   %rax
push   %r10
call   1050 <sscanf@plt>
add    $0x10,%rsp
addl   $0xfffff894,(%rsp)
addl   $0xffffffff,0x4(%rsp)
mov    %r14,%rdi
call   1040 <gmmktime@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [30 x i8] c"%04d-%02d-%02dT%02d:%02d:%02d\00"
define i32 @parse_xml_time(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm
store i8* %0, i8** %2
%4 = call i32 @memset(%struct.tm* %3, i32 0, i32 24)
%5 = load i8*, i8** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%8 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
%12 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%14 = load i32, i32* %13
%15 = sub nsw i32 %14, 1900
store i32 %15, i32* %13
%16 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, -1
store i32 %18, i32* %16
%19 = call i32 @gmmktime(%struct.tm* %3)
ret i32 %19
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [30 x i8] c"%04d-%02d-%02dT%02d:%02d:%02d\00"
define i32 @parse_xml_time(i8* nocapture %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i32 @memset(%struct.tm* %2, i32 0, i32 24)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 5
%8 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
%11 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10)
%12 = load i32, i32* %5
%13 = add nsw i32 %12, -1900
store i32 %13, i32* %5
%14 = load i32, i32* %6
%15 = add nsw i32 %14, -1
store i32 %15, i32* %6
%16 = call i32 @gmmktime(%struct.tm* %2)
ret i32 %16
}