#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_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ printf(char *, long, long);
void print_times() {
  struct rusage ru;
  long total_sec, total_usec;
  getrusage(RUSAGE_SELF, &ru);
  printf(" u=%ld.%06ldsec", (long)ru.ru_utime.tv_sec,
         (long)ru.ru_utime.tv_usec);
  printf(" s=%ld.%06ldsec", (long)ru.ru_stime.tv_sec,
         (long)ru.ru_stime.tv_usec);
  total_usec = (long)ru.ru_utime.tv_usec + (long)ru.ru_stime.tv_usec;
  total_sec = (long)ru.ru_utime.tv_sec + (long)ru.ru_stime.tv_sec;
  if (total_usec >= 1000000) {
    total_usec -= 1000000;
    total_sec++;
  }
  printf(" t=%ld.%06ldsec", total_sec, total_usec);
}


x86 assembly (clang, -O0):
<print_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0xf4240,-0x30(%rbp)
jl     11a2 <print_times+0x82>
mov    -0x30(%rbp),%rax
sub    $0xf4240,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_times>:
sub    $0x28,%rsp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1040 <getrusage@plt>
mov    0x18(%rsp),%rsi
mov    0x20(%rsp),%rdx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%rdx
add    0x18(%rsp),%rcx
lea    (%rdx,%rax,1),%rdi
xor    %esi,%esi
cmp    $0xf4240,%rdi
setge  %sil
lea    -0xf4240(%rdx,%rax,1),%rdx
ff
cmovl  %rdi,%rdx
add    %rcx,%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
add    $0x28,%rsp
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 = [16 x i8] c" u=%ld.%06ldsec\00"
@.str.1 = [16 x i8] c" s=%ld.%06ldsec\00"
@.str.2 = [16 x i8] c" t=%ld.%06ldsec\00"
define void @print_times() {
%1 = alloca %struct.rusage
%2 = alloca i64
%3 = alloca i64
%4 = load i32, i32* @RUSAGE_SELF
%5 = call i32 @getrusage(i32 %4, %struct.rusage* %1)
%6 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 1
%11 = load i64, i64* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %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 0
%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 1
%18 = load i64, i64* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %15, i64 %18)
%20 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 1
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 1
%25 = load i64, i64* %24
%26 = add nsw i64 %22, %25
store i64 %26, i64* %3
%27 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%28 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %27, i32 0, i32 0
%29 = load i64, i64* %28
%30 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %30, i32 0, i32 0
%32 = load i64, i64* %31
%33 = add nsw i64 %29, %32
store i64 %33, i64* %2
%34 = load i64, i64* %3
%35 = icmp sge i64 %34, 1000000
br i1 %35, label %36, label %41
36: ; preds = %0
%37 = load i64, i64* %3
%38 = sub nsw i64 %37, 1000000
store i64 %38, i64* %3
%39 = load i64, i64* %2
%40 = add nsw i64 %39, 1
store i64 %40, i64* %2
br label %41
41: ; preds = %36, %0
%42 = load i64, i64* %2
%43 = load i64, i64* %3
%44 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i64 %42, i64 %43)
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 = [16 x i8] c" u=%ld.%06ldsec\00"
@.str.1 = [16 x i8] c" s=%ld.%06ldsec\00"
@.str.2 = [16 x i8] c" t=%ld.%06ldsec\00"
define void @print_times() {
%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 0
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 1
%8 = load i64, i64* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %6, i64 %8)
%10 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%11 = load i64, i64* %10
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%13 = load i64, i64* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %11, i64 %13)
%15 = load i64, i64* %7
%16 = load i64, i64* %12
%17 = add nsw i64 %16, %15
%18 = load i64, i64* %5
%19 = load i64, i64* %10
%20 = add nsw i64 %19, %18
%21 = icmp sgt i64 %17, 999999
%22 = add nsw i64 %17, -1000000
%23 = zext i1 %21 to i64
%24 = add nsw i64 %20, %23
%25 = select i1 %21, i64 %22, i64 %17
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i64 %24, i64 %25)
ret void
}