#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 time_t;
struct tm {
  int tm_hour;
  int tm_mday;
  int tm_year;
  int tm_isdst;
  scalar_t__ tm_mon;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int mktime(struct tm *);
int /*<<< orphan*/ stderr;
time_t get_hour_diff(void) {
  struct tm datum_day;
  datum_day.tm_sec = 0;
  datum_day.tm_min = 0;
  datum_day.tm_hour = 12;
  datum_day.tm_mday = 2;
  datum_day.tm_mon = 0;
  datum_day.tm_year = 30;
  datum_day.tm_isdst = -1;
  const time_t datum_time = mktime(&datum_day);
  if (datum_time == -1) {
    fprintf(stderr, "pgtime:%s:%d: couldn't get calendar 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",
            165);
    exit(EXIT_FAILURE);
  }
  datum_day.tm_hour += 1;
  const time_t nexthour_time = mktime(&datum_day);
  if (nexthour_time == -1) {
    fprintf(stderr, "pgtime:%s:%d: couldn't get calendar 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",
            174);
    exit(EXIT_FAILURE);
  }
  return (nexthour_time - datum_time);
}


x86 assembly (clang, -O0):
<get_hour_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xc,-0x28(%rbp)
movl   $0x2,-0x24(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1e,-0x20(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    11b1 <get_hour_diff+0x81>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
lea    0xe92(%rip),%rdx
mov    $0xa5,%ecx
call   1030 <fprintf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    11ff <get_hour_diff+0xcf>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
lea    0xe44(%rip),%rdx
mov    $0xae,%ecx
call   1030 <fprintf@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x30(%rbp),%eax
sub    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hour_diff>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
cmp    $0xffffffff,%eax
je     1179 <get_hour_diff+0x49>
mov    %eax,%ebx
addl   $0x1,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
cmp    $0xffffffff,%eax
je     1197 <get_hour_diff+0x67>
sub    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
lea    0xeab(%rip),%rdx
mov    $0xa5,%ecx
jmp    11b3 <get_hour_diff+0x83>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
lea    0xe8d(%rip),%rdx
mov    $0xae,%ecx
call   1030 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@stderr = global i32 0
@.str = [43 x i8] c"pgtime:%s:%d: couldn't get calendar 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_hour_diff() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 6
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 5
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
store i32 12, i32* %6
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
store i32 2, i32* %7
%8 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 4
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
store i32 30, i32* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 3
store i32 -1, i32* %10
%11 = call i32 @mktime(%struct.tm* %1)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 165)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %0
%20 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
%23 = call i32 @mktime(%struct.tm* %1)
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %31
26: ; preds = %19
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 174)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %19
%32 = load i32, i32* %3
%33 = load i32, i32* %2
%34 = sub nsw i32 %32, %33
ret i32 %34
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@stderr = global i32 0
@.str = [43 x i8] c"pgtime:%s:%d: couldn't get calendar 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_hour_diff() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%5 = bitcast i64* %3 to i8*
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
store i64 0, i64* %6
%7 = bitcast %struct.tm* %1 to <4 x i32>*
store <4 x i32> <i32 12, i32 2, i32 30, i32 -1>, <4 x i32>* %7
%8 = call i32 @mktime(%struct.tm* %1)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 165)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = call i32 @mktime(%struct.tm* %1)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 174)
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %15
%26 = sub nsw i32 %18, %8
ret i32 %26
}