#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 */

/* Variables and functions */
scalar_t__ gf_cputime(long *, long *, long *, long *);
void __cpu_time_1(long *sec, long *usec) {
  long user_sec, user_usec, system_sec, system_usec;
  if (gf_cputime(&user_sec, &user_usec, &system_sec, &system_usec) == 0) {
    *sec = user_sec + system_sec;
    *usec = user_usec + system_usec;
  } else {
    *sec = -1;
    *usec = 0;
  }
}


x86 assembly (clang, -O0):
<__cpu_time_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <gf_cputime@plt>
cmp    $0x0,%rax
jne    1162 <__cpu_time_1+0x52>
mov    -0x18(%rbp),%rcx
add    -0x28(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
add    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    1178 <__cpu_time_1+0x68>
mov    -0x8(%rbp),%rax
movq   $0xffffffffffffffff,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__cpu_time_1>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <gf_cputime@plt>
test   %rax,%rax
je     1146 <__cpu_time_1+0x36>
movq   $0xffffffffffffffff,(%rbx)
xor    %eax,%eax
jmp    115d <__cpu_time_1+0x4d>
mov    0x10(%rsp),%rax
add    0x20(%rsp),%rax
mov    %rax,(%rbx)
mov    0x8(%rsp),%rax
add    0x18(%rsp),%rax
mov    %rax,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @__cpu_time_1(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%9 = call i64 @gf_cputime(i64* %5, i64* %6, i64* %7, i64* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = load i64, i64* %5
%13 = load i64, i64* %7
%14 = add nsw i64 %12, %13
%15 = load i64*, i64** %3
store i64 %14, i64* %15
%16 = load i64, i64* %6
%17 = load i64, i64* %8
%18 = add nsw i64 %16, %17
%19 = load i64*, i64** %4
store i64 %18, i64* %19
br label %23
20: ; preds = %2
%21 = load i64*, i64** %3
store i64 -1, i64* %21
%22 = load i64*, i64** %4
store i64 0, i64* %22
br label %23
23: ; preds = %20, %11
ret void
}

LLVM IR (-O2):
define void @__cpu_time_1(i64* nocapture writeonly %0, i64* nocapture writeonly %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = call i64 @gf_cputime(i64* %3, i64* %4, i64* %5, i64* %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i64, i64* %3
%15 = load i64, i64* %5
%16 = add nsw i64 %15, %14
store i64 %16, i64* %0
%17 = load i64, i64* %4
%18 = load i64, i64* %6
%19 = add nsw i64 %18, %17
br label %21
20: ; preds = %2
store i64 -1, i64* %0
br label %21
21: ; preds = %20, %13
%22 = phi i64 [ 0, %20 ], [ %19, %13 ]
store i64 %22, i64* %1
ret void
}