#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 tms {
  scalar_t__ tms_cstime;
  scalar_t__ tms_cutime;
  scalar_t__ tms_stime;
  scalar_t__ tms_utime;
};
typedef scalar_t__ clock_t;

/* Variables and functions */
int __syscall(int, scalar_t__ *);
clock_t _times(struct tms *tp) {
  clock_t utime;
  int err;
  err = __syscall(43, &utime);
  if (err)
    utime = 0;
  if (tp) {
    tp->tms_utime = utime;
    tp->tms_stime = 0;
    tp->tms_cutime = 0;
    tp->tms_cstime = 0;
  }
  return utime;
}


x86 assembly (clang, -O0):
<_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2b,%edi
lea    -0x10(%rbp),%rsi
call   1030 <__syscall@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     113f <_times+0x2f>
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1179 <_times+0x69>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_times>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x2b,%edi
call   1030 <__syscall@plt>
test   %eax,%eax
je     1134 <_times+0x24>
movq   $0x0,0x8(%rsp)
mov    0x8(%rsp),%rax
test   %rbx,%rbx
je     1150 <_times+0x40>
mov    %rax,0x18(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
movq   $0x0,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tms = type { i64, i64, i64, i64 }
define i64 @_times(%struct.tms* %0) {
%2 = alloca %struct.tms*
%3 = alloca i64
%4 = alloca i32
store %struct.tms* %0, %struct.tms** %2
%5 = call i32 @__syscall(i32 43, i64* %3)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i64 0, i64* %3
br label %9
9: ; preds = %8, %1
%10 = load %struct.tms*, %struct.tms** %2
%11 = icmp ne %struct.tms* %10, null
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i64, i64* %3
%14 = load %struct.tms*, %struct.tms** %2
%15 = getelementptr inbounds %struct.tms, %struct.tms* %14, i32 0, i32 3
store i64 %13, i64* %15
%16 = load %struct.tms*, %struct.tms** %2
%17 = getelementptr inbounds %struct.tms, %struct.tms* %16, i32 0, i32 2
store i64 0, i64* %17
%18 = load %struct.tms*, %struct.tms** %2
%19 = getelementptr inbounds %struct.tms, %struct.tms* %18, i32 0, i32 1
store i64 0, i64* %19
%20 = load %struct.tms*, %struct.tms** %2
%21 = getelementptr inbounds %struct.tms, %struct.tms* %20, i32 0, i32 0
store i64 0, i64* %21
br label %22
22: ; preds = %12, %9
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
%struct.tms = type { i64, i64, i64, i64 }
define i64 @_times(%struct.tms* writeonly %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @__syscall(i32 43, i64* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i64 0, i64* %2
br label %7
7: ; preds = %6, %1
%8 = icmp eq %struct.tms* %0, null
%9 = load i64, i64* %2
br i1 %8, label %13, label %10
10: ; preds = %7
%11 = getelementptr inbounds %struct.tms, %struct.tms* %0, i64 0, i32 3
store i64 %9, i64* %11
%12 = bitcast %struct.tms* %0 to i8*
br label %13
13: ; preds = %7, %10
ret i64 %9
}