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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ sscanf(char const *, char *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t strToTime(const char *timeString) {
  time_t t = time(NULL);
  struct tm when = *localtime(&t);
  sscanf(timeString, "%d:%d:%d", &when.tm_hour, &when.tm_min, &when.tm_sec);
  time_t tt = mktime(&when);
  return tt;
}


x86 assembly (clang, -O0):
<strToTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x18(%rbp)
mov    0x8(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rdx
add    $0x8,%rdx
lea    -0x18(%rbp),%rcx
add    $0x4,%rcx
lea    -0x18(%rbp),%r8
lea    0xe73(%rip),%rsi
call   1050 <sscanf@plt>
lea    -0x18(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToTime>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
mov    %rcx,0x8(%rsp)
mov    0x8(%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0xe81(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%r8
call   1050 <sscanf@plt>
mov    %rbx,%rdi
call   1060 <mktime@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [9 x i8] c"%d:%d:%d\00"
define i32 @strToTime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 @time(i32* null)
store i32 %6, i32* %3
%7 = call %struct.tm* @localtime(i32* %3)
%8 = bitcast %struct.tm* %4 to i8*
%9 = bitcast %struct.tm* %7 to i8*
%10 = load i8*, i8** %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%14 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %11, i32* %12, i32* %13)
%15 = call i32 @mktime(%struct.tm* %4)
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [9 x i8] c"%d:%d:%d\00"
define i32 @strToTime(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca %struct.tm
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = bitcast %struct.tm* %3 to i8*
%7 = call %struct.tm* @localtime(i32* %2)
%8 = bitcast %struct.tm* %7 to i8*
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %9, i32* %10, i32* %11)
%13 = call i32 @mktime(%struct.tm* %3)
ret i32 %13
}