#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__ {
  int tv_sec;
  long tv_usec;
};
struct TYPE_3__ {
  int tv_sec;
  long tv_usec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
long clock() {
  struct rusage rusage;
  getrusage(0, &rusage);
  return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec +
          rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
}


x86 assembly (clang, -O0):
<clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
lea    -0x20(%rbp),%rsi
call   1030 <getrusage@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
imul   $0xf4240,-0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock>:
sub    $0x28,%rsp
lea    0x8(%rsp),%rsi
xor    %edi,%edi
call   1030 <getrusage@plt>
movslq 0x18(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x20(%rsp),%rax
movslq 0x8(%rsp),%rcx
imul   $0xf4240,%rcx,%rcx
add    0x10(%rsp),%rax
add    %rcx,%rax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i64 }
define i64 @clock() {
%1 = alloca %struct.rusage
%2 = call i32 @getrusage(i32 0, %struct.rusage* %1)
%3 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = add nsw i64 %7, %10
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = mul nsw i32 %14, 1000000
%16 = sext i32 %15 to i64
%17 = add nsw i64 %11, %16
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 1
%20 = load i64, i64* %19
%21 = add nsw i64 %17, %20
ret i64 %21
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i64 }
%struct.TYPE_3__ = type { i32, i64 }
define i64 @clock() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = call i32 @getrusage(i32 0, %struct.rusage* %1)
%4 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 1000000
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%16 = load i64, i64* %15
%17 = add i64 %10, %16
%18 = add i64 %17, %14
ret i64 %18
}