#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  long tv_usec;
};
struct TYPE_3__ {
  long tv_usec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ exit(int);
scalar_t__ getrusage(int /*<<< orphan*/, struct rusage *);
long ptime_micros(void) {
  long t;
  struct rusage info;
  if (getrusage(RUSAGE_SELF, &info))
    exit(1);
  t = (info.ru_utime.tv_usec + info.ru_stime.tv_usec);
  return (t);
}


x86 assembly (clang, -O0):
<ptime_micros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1030 <getrusage@plt>
cmp    $0x0,%rax
je     114e <ptime_micros+0x2e>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptime_micros>:
sub    $0x18,%rsp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <getrusage@plt>
test   %rax,%rax
jne    114b <ptime_micros+0x2b>
mov    0x8(%rsp),%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64 }
%struct.TYPE_3__ = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @ptime_micros() {
%1 = alloca i64
%2 = alloca %struct.rusage
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i64 @getrusage(i32 %3, %struct.rusage* %2)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 0
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%14 = load i64, i64* %13
%15 = add nsw i64 %11, %14
store i64 %15, i64* %1
%16 = load i64, i64* %1
ret i64 %16
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64 }
%struct.TYPE_3__ = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @ptime_micros() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i64 @getrusage(i32 %3, %struct.rusage* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 0
%10 = load i64, i64* %9
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%12 = load i64, i64* %11
%13 = add nsw i64 %12, %10
ret i64 %13
}