#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*/ fatal_error(char *, char *, int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ my_perror(char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ strlcpy(char *, char *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_date_for_pgn(char *date) {
  time_t td;
  struct tm *dcp;
  if ((1) <= 1 && !(date != NULL))
    fatal_error("%s:%u: Assertion '"
                "date != NULL"
                "' failed.",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/cutechess/sloppy/refs/heads/"
                "master/src/game.c",
                237);
  ;
  time(&td);
  dcp = localtime(&td);
  if (dcp != NULL)
    strftime(date, 256, "%Y.%m.%d", dcp);
  else {
    my_perror("Couldn't get local time");
    strlcpy(date, "<no date>", 256);
  }
}


x86 assembly (clang, -O0):
<get_date_for_pgn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    118f <get_date_for_pgn+0x2f>
lea    0xe82(%rip),%rdi
lea    0xea3(%rip),%rsi
mov    $0xed,%edx
call   1050 <fatal_error@plt>
lea    -0xc(%rbp),%rdi
call   1040 <time@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11ce <get_date_for_pgn+0x6e>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x100,%esi
lea    0xeec(%rip),%rdx
call   1080 <strftime@plt>
jmp    11ef <get_date_for_pgn+0x8f>
lea    0xee4(%rip),%rdi
call   1070 <my_perror@plt>
mov    -0x8(%rbp),%rdi
lea    0xeec(%rip),%rsi
mov    $0x100,%edx
call   1060 <strlcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_date_for_pgn>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
jne    1184 <get_date_for_pgn+0x24>
lea    0xe8d(%rip),%rdi
lea    0xeae(%rip),%rsi
mov    $0xed,%edx
call   1050 <fatal_error@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     11b7 <get_date_for_pgn+0x57>
lea    0xf0b(%rip),%rdx
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
jmp    11d7 <get_date_for_pgn+0x77>
lea    0xefb(%rip),%rdi
call   1070 <my_perror@plt>
lea    0xf07(%rip),%rsi
mov    %r14,%rdi
mov    $0x100,%edx
call   1060 <strlcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [40 x i8] c"%s:%u: Assertion 'date != NULL' failed.\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cutechess/sloppy/refs/heads/master/src/game.c\00"
@.str.2 = [9 x i8] c"%Y.%m.%d\00"
@.str.3 = [24 x i8] c"Couldn't get local time\00"
@.str.4 = [10 x i8] c"<no date>\00"
define void @get_date_for_pgn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @fatal_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 237)
br label %9
9: ; preds = %7, %1
%10 = call i32 @time(i32* %3)
%11 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %11, %struct.tm** %4
%12 = load %struct.tm*, %struct.tm** %4
%13 = icmp ne %struct.tm* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load %struct.tm*, %struct.tm** %4
%17 = call i32 @strftime(i8* %15, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %16)
br label %22
18: ; preds = %9
%19 = call i32 @my_perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%20 = load i8*, i8** %2
%21 = call i32 @strlcpy(i8* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 256)
br label %22
22: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [40 x i8] c"%s:%u: Assertion 'date != NULL' failed.\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cutechess/sloppy/refs/heads/master/src/game.c\00"
@.str.2 = [9 x i8] c"%Y.%m.%d\00"
@.str.3 = [24 x i8] c"Couldn't get local time\00"
@.str.4 = [10 x i8] c"<no date>\00"
define void @get_date_for_pgn(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @fatal_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 237)
br label %7
7: ; preds = %5, %1
%8 = call i32 @time(i32* %2)
%9 = call %struct.tm* @localtime(i32* %2)
%10 = icmp eq %struct.tm* %9, null
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 @strftime(i8* %0, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %struct.tm* %9)
br label %16
13: ; preds = %7
%14 = call i32 @my_perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @strlcpy(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 256)
br label %16
16: ; preds = %13, %11
ret void
}