#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_3__ {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};
struct TYPE_4__ {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};
struct rusage {
  TYPE_1__ ru_stime;
  TYPE_2__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_CHILDREN;
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ printf(char *, scalar_t__, scalar_t__);
void print_rusage() {
  struct rusage ru;
  getrusage(RUSAGE_SELF, &ru);
  printf(
      "USAGE BY SELF:\n user: %lld\n system: %lld\n\n",
      ((ru.ru_utime).tv_usec + (long long)((ru.ru_utime).tv_sec) * 1000 * 1000),
      ((ru.ru_stime).tv_usec +
       (long long)((ru.ru_stime).tv_sec) * 1000 * 1000));
  getrusage(RUSAGE_CHILDREN, &ru);
  printf(
      "USAGE BY CHILDREN:\n user: %lld\n system: %lld\n\n",
      ((ru.ru_utime).tv_usec + (long long)((ru.ru_utime).tv_sec) * 1000 * 1000),
      ((ru.ru_stime).tv_usec +
       (long long)((ru.ru_stime).tv_sec) * 1000 * 1000));
}


x86 assembly (clang, -O0):
<print_rusage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x8(%rbp),%rsi
imul   $0x3e8,-0x10(%rbp),%rax
imul   $0x3e8,%rax,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
imul   $0x3e8,-0x20(%rbp),%rax
imul   $0x3e8,%rax,%rax
add    %rax,%rdx
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x8(%rbp),%rsi
imul   $0x3e8,-0x10(%rbp),%rax
imul   $0x3e8,%rax,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
imul   $0x3e8,-0x20(%rbp),%rax
imul   $0x3e8,%rax,%rax
add    %rax,%rdx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_rusage>:
push   %rbx
sub    $0x20,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <getrusage@plt>
imul   $0xf4240,0x10(%rsp),%rsi
add    0x18(%rsp),%rsi
imul   $0xf4240,(%rsp),%rdx
add    0x8(%rsp),%rdx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <getrusage@plt>
imul   $0xf4240,0x10(%rsp),%rsi
add    0x18(%rsp),%rsi
imul   $0xf4240,(%rsp),%rdx
add    0x8(%rsp),%rdx
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_3__, %struct.TYPE_4__ }
%struct.TYPE_3__ = type { i64, i64 }
%struct.TYPE_4__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [43 x i8] c"USAGE BY SELF:\0A user: %lld\0A system: %lld\0A\0A\00"
@RUSAGE_CHILDREN = global i32 0
@.str.1 = [47 x i8] c"USAGE BY CHILDREN:\0A user: %lld\0A system: %lld\0A\0A\00"
define void @print_rusage() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%4 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 1
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = load i64, i64* %8
%10 = mul nsw i64 %9, 1000
%11 = mul nsw i64 %10, 1000
%12 = add nsw i64 %6, %11
%13 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i32 0, i32 1
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = mul nsw i64 %18, 1000
%20 = mul nsw i64 %19, 1000
%21 = add nsw i64 %15, %20
%22 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64 %12, i64 %21)
%23 = load i32, i32* @RUSAGE_CHILDREN
%24 = call i32 @getrusage(i32 %23, %struct.rusage* %1)
%25 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%26 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %25, i32 0, i32 1
%27 = load i64, i64* %26
%28 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
%30 = load i64, i64* %29
%31 = mul nsw i64 %30, 1000
%32 = mul nsw i64 %31, 1000
%33 = add nsw i64 %27, %32
%34 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%35 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %34, i32 0, i32 1
%36 = load i64, i64* %35
%37 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%38 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %37, i32 0, i32 0
%39 = load i64, i64* %38
%40 = mul nsw i64 %39, 1000
%41 = mul nsw i64 %40, 1000
%42 = add nsw i64 %36, %41
%43 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %33, i64 %42)
ret void
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_3__, %struct.TYPE_4__ }
%struct.TYPE_3__ = type { i64, i64 }
%struct.TYPE_4__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [43 x i8] c"USAGE BY SELF:\0A user: %lld\0A system: %lld\0A\0A\00"
@RUSAGE_CHILDREN = global i32 0
@.str.1 = [47 x i8] c"USAGE BY CHILDREN:\0A user: %lld\0A system: %lld\0A\0A\00"
define void @print_rusage() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i32 @getrusage(i32 %3, %struct.rusage* %1)
%5 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 1
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 0
%8 = load i64, i64* %7
%9 = mul i64 %8, 1000000
%10 = add nsw i64 %9, %6
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%14 = load i64, i64* %13
%15 = mul i64 %14, 1000000
%16 = add nsw i64 %15, %12
%17 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %16)
%18 = load i32, i32* @RUSAGE_CHILDREN
%19 = call i32 @getrusage(i32 %18, %struct.rusage* %1)
%20 = load i64, i64* %5
%21 = load i64, i64* %7
%22 = mul i64 %21, 1000000
%23 = add nsw i64 %22, %20
%24 = load i64, i64* %11
%25 = load i64, i64* %13
%26 = mul i64 %25, 1000000
%27 = add nsw i64 %26, %24
%28 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %23, i64 %27)
ret void
}