#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_sec;
  scalar_t__ tm_mon;
  scalar_t__ tm_min;
};

/* 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_sec_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",
            206);
    exit(EXIT_FAILURE);
  }
  datum_day.tm_sec += 1;
  const time_t nextsec_time = mktime(&datum_day);
  if (nextsec_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",
            215);
    exit(EXIT_FAILURE);
  }
  return (nextsec_time - datum_time);
}


x86 assembly (clang, -O0):
<get_sec_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x8(%rbp)
movl   $0xc,-0x28(%rbp)
movl   $0x2,-0x24(%rbp)
movq   $0x0,-0x10(%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_sec_diff+0x81>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
lea    0xe92(%rip),%rdx
mov    $0xce,%ecx
call   1030 <fprintf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
lea    -0x28(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    1202 <get_sec_diff+0xd2>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
lea    0xe41(%rip),%rdx
mov    $0xd7,%ecx
call   1030 <fprintf@plt>
mov    0x2ddd(%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_sec_diff>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
cmp    $0xffffffff,%eax
je     117b <get_sec_diff+0x4b>
mov    %eax,%ebx
addq   $0x1,0x10(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
cmp    $0xffffffff,%eax
je     1199 <get_sec_diff+0x69>
sub    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
lea    0xea9(%rip),%rdx
mov    $0xce,%ecx
jmp    11b5 <get_sec_diff+0x85>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    $0xd7,%ecx
call   1030 <fprintf@plt>
mov    0x2e17(%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_sec_diff() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 4
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 6
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 5
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 206)
%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 4
%21 = load i64, i64* %20
%22 = add nsw i64 %21, 1
store i64 %22, i64* %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 215)
%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_sec_diff() {
%1 = alloca %struct.tm
%2 = bitcast %struct.tm* %1 to i8*
%3 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
store i64 0, i64* %3
%4 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
store i64 0, i64* %5
%6 = bitcast %struct.tm* %1 to <4 x i32>*
store <4 x i32> <i32 12, i32 2, i32 30, i32 -1>, <4 x i32>* %6
%7 = call i32 @mktime(%struct.tm* %1)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, 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 206)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
%15 = load i64, i64* %3
%16 = add nsw i64 %15, 1
store i64 %16, i64* %3
%17 = call i32 @mktime(%struct.tm* %1)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, 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 215)
%22 = load i32, i32* @EXIT_FAILURE
%23 = tail call i32 @exit(i32 %22)
unreachable
24: ; preds = %14
%25 = sub nsw i32 %17, %7
ret i32 %25
}