#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 */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror_r(int /*<<< orphan*/, char *, int);
long long gtod64() {
  int e;
  struct timeval cur_tv;
  e = gettimeofday(&cur_tv, NULL);
  do {
    char errbuf[99];
    if (e != 0) {
      strerror_r(errno, errbuf, 99);
      do {
        fprintf(stderr, "Fatal error [%s,%d]: '%s'\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/fordsfords/catchup/refs/"
                "heads/master/catchup.c",
                32, errbuf);
        exit(1);
      } while (0);
    }
  } while (0);
  return (long long)cur_tv.tv_sec * 1000000ll + (long long)cur_tv.tv_usec;
}


x86 assembly (clang, -O0):
<gtod64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11ab <gtod64+0x6b>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
mov    $0x63,%edx
call   1050 <strerror_r@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%r8
lea    0xe70(%rip),%rsi
lea    0xe84(%rip),%rdx
mov    $0x20,%ecx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11b0 <gtod64+0x70>
imul   $0xf4240,-0x10(%rbp),%rax
add    -0x18(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtod64>:
push   %rbx
sub    $0x80,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %eax,%eax
jne    116c <gtod64+0x2c>
imul   $0xf4240,0x8(%rsp),%rax
add    (%rsp),%rax
add    $0x80,%rsp
pop    %rbx
ret
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x63,%edx
call   1050 <strerror_r@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
lea    0xe7d(%rip),%rdx
mov    $0x20,%ecx
mov    %rbx,%r8
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@errno = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Fatal error [%s,%d]: '%s'\0A\00"
@.str.1 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fordsfords/catchup/refs/heads/master/catchup.c\00"
define i64 @gtod64() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca [99 x i8]
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
store i32 %4, i32* %1
br label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* @errno
%10 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
%11 = call i32 @strerror_r(i32 %9, i8* %10, i32 99)
br label %12
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 32, i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; No predecessors!
br label %18
18: ; preds = %17, %5
br label %19
19: ; preds = %18
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%21 = load i64, i64* %20
%22 = mul nsw i64 %21, 1000000
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%24 = load i64, i64* %23
%25 = add nsw i64 %22, %24
ret i64 %25
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@errno = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Fatal error [%s,%d]: '%s'\0A\00"
@.str.1 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fordsfords/catchup/refs/heads/master/catchup.c\00"
define i64 @gtod64() {
%1 = alloca %struct.timeval
%2 = alloca [99 x i8]
%3 = bitcast %struct.timeval* %1 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%5 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 0
%6 = icmp eq i32 %4, 0
br i1 %6, label %13, label %7
7: ; preds = %0
%8 = load i32, i32* @errno
%9 = call i32 @strerror_r(i32 %8, i8* %5, i32 99)
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 32, i8* %5)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%15 = load i64, i64* %14
%16 = mul nsw i64 %15, 1000000
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%18 = load i64, i64* %17
%19 = add nsw i64 %16, %18
ret i64 %19
}