#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
struct tm *gmtime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ stderr;
int tm_intraday_secs_diff(struct tm const *, struct tm *);
int get_utc_timestamp_sec_diff(const time_t check_time,
                               const struct tm *utc_tm) {
  struct tm *ptm = gmtime(&check_time);
  if (ptm == 0) {
    fprintf(stderr, "pgtime:%s:%d: couldn't get UTC time.\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/paulgriffiths/pgtime/refs/heads/master/"
            "pgtime.c",
            766);
    exit(EXIT_FAILURE);
  }
  struct tm check_tm = *ptm;
  return tm_intraday_secs_diff(utc_tm, &check_tm);
}


x86 assembly (clang, -O0):
<get_utc_timestamp_sec_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1196 <get_utc_timestamp_sec_diff+0x56>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
lea    0xea8(%rip),%rdx
mov    $0x2fe,%ecx
call   1030 <fprintf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <tm_intraday_secs_diff@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_utc_timestamp_sec_diff>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
test   %rax,%rax
je     1174 <get_utc_timestamp_sec_diff+0x34>
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <tm_intraday_secs_diff@plt>
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
lea    0xe9b(%rip),%rdx
mov    $0x2fe,%ecx
call   1030 <fprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [38 x i8] c"pgtime:%s:%d: couldn't get UTC time.\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgtime/refs/heads/master/pgtime.c\00"
@EXIT_FAILURE = global i32 0
define i32 @get_utc_timestamp_sec_diff(i32 %0, %struct.tm* %1) {
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca %struct.tm*
%6 = alloca %struct.tm
store i32 %0, i32* %3
store %struct.tm* %1, %struct.tm** %4
%7 = call %struct.tm* @gmtime(i32* %3)
store %struct.tm* %7, %struct.tm** %5
%8 = load %struct.tm*, %struct.tm** %5
%9 = icmp eq %struct.tm* %8, null
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 766)
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load %struct.tm*, %struct.tm** %5
%17 = bitcast %struct.tm* %6 to i8*
%18 = bitcast %struct.tm* %16 to i8*
%19 = load %struct.tm*, %struct.tm** %4
%20 = call i32 @tm_intraday_secs_diff(%struct.tm* %19, %struct.tm* %6)
ret i32 %20
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@stderr = global i32 0
@.str = [38 x i8] c"pgtime:%s:%d: couldn't get UTC time.\0A\00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgtime/refs/heads/master/pgtime.c\00"
@EXIT_FAILURE = global i32 0
define i32 @get_utc_timestamp_sec_diff(i32 %0, %struct.tm* %1) {
%3 = alloca i32
%4 = alloca %struct.tm
store i32 %0, i32* %3
%5 = call %struct.tm* @gmtime(i32* %3)
%6 = icmp eq %struct.tm* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 766)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = bitcast %struct.tm* %4 to i8*
%14 = getelementptr %struct.tm, %struct.tm* %5, i64 0, i32 0
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%16 = load i32, i32* %14
store i32 %16, i32* %15
%17 = call i32 @tm_intraday_secs_diff(%struct.tm* %1, %struct.tm* %4)
ret i32 %17
}