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

/* Variables and functions */
unsigned long approxidate_str(char const *, struct timeval const *, int *);
int /*<<< orphan*/ parse_date_basic(char const *, unsigned long *, int *);
unsigned long approxidate_relative(const char *date, const struct timeval *tv) {
  unsigned long timestamp;
  int offset;
  int errors = 0;
  if (!parse_date_basic(date, &timestamp, &offset))
    return timestamp;
  return approxidate_str(date, tv, &errors);
}


x86 assembly (clang, -O0):
<approxidate_relative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <parse_date_basic@plt>
cmp    $0x0,%eax
jne    115e <approxidate_relative+0x3e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1173 <approxidate_relative+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <approxidate_str@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<approxidate_relative>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1040 <parse_date_basic@plt>
test   %eax,%eax
je     115a <approxidate_relative+0x3a>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <approxidate_str@plt>
jmp    115f <approxidate_relative+0x3f>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i64 @approxidate_relative(i8* %0, %struct.timeval* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca %struct.timeval*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store %struct.timeval* %1, %struct.timeval** %5
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = call i32 @parse_date_basic(i8* %9, i64* %6, i32* %7)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = load i64, i64* %6
store i64 %13, i64* %3
br label %18
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load %struct.timeval*, %struct.timeval** %5
%17 = call i64 @approxidate_str(i8* %15, %struct.timeval* %16, i32* %8)
store i64 %17, i64* %3
br label %18
18: ; preds = %14, %12
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i64 @approxidate_relative(i8* %0, %struct.timeval* %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i64* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call i32 @parse_date_basic(i8* %0, i64* %3, i32* %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i64, i64* %3
br label %15
13: ; preds = %2
%14 = call i64 @approxidate_str(i8* %0, %struct.timeval* %1, i32* %5)
br label %15
15: ; preds = %13, %11
%16 = phi i64 [ %14, %13 ], [ %12, %11 ]
ret i64 %16
}