#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 timespec {
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ parse_time(char const **, struct timespec *);
scalar_t__ time(int /*<<< orphan*/ *);
bool parse_before(const char **string, struct timespec *ts) {
  return parse_time(string, ts) && ({
           ts->tv_sec = time(NULL) - ts->tv_sec;
           true;
         });
}


x86 assembly (clang, -O0):
<parse_before>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <parse_time@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
je     117a <parse_before+0x5a>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
sub    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_before>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <parse_time@plt>
mov    %rax,%r14
test   %rax,%rax
je     1141 <parse_before+0x21>
xor    %edi,%edi
call   1040 <time@plt>
sub    (%rbx),%rax
mov    %rax,(%rbx)
xor    %eax,%eax
test   %r14,%r14
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i64 }
define i32 @parse_before(i8** %0, %struct.timespec* %1) {
%3 = alloca i8**
%4 = alloca %struct.timespec*
%5 = alloca i32
store i8** %0, i8*** %3
store %struct.timespec* %1, %struct.timespec** %4
%6 = load i8**, i8*** %3
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = call i64 @parse_time(i8** %6, %struct.timespec* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = call i64 @time(i32* null)
%12 = load %struct.timespec*, %struct.timespec** %4
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
%14 = load i64, i64* %13
%15 = sub nsw i64 %11, %14
%16 = load %struct.timespec*, %struct.timespec** %4
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
store i64 %15, i64* %17
store i32 1, i32* %5
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
br label %20
20: ; preds = %10, %2
%21 = phi i1 [ false, %2 ], [ %19, %10 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
%struct.timespec = type { i64 }
define i32 @parse_before(i8** %0, %struct.timespec* %1) {
%3 = tail call i64 @parse_time(i8** %0, %struct.timespec* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i64 @time(i32* null)
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sub nsw i64 %6, %8
store i64 %9, i64* %7
br label %10
10: ; preds = %5, %2
%11 = xor i1 %4, true
%12 = zext i1 %11 to i32
ret i32 %12
}