#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 rusage {
  int ru_utime;
  int ru_stime;
  int ru_maxrss;
  int ru_ixrss;
  int ru_idrss;
  int ru_isrss;
  int ru_minflt;
  int ru_majflt;
  int ru_nswap;
  int ru_inblock;
  int ru_oublock;
  int ru_msgsnd;
  int ru_msgrcv;
  int ru_nsignals;
  int ru_nvcsw;
  int ru_nivcsw;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ printf(char *, int);
void print_proc_stats(pid_t pid) {
  struct rusage usage;
  int rc = getrusage(RUSAGE_SELF, &usage);
  printf("getrusage() returned %d.\n", rc);
  if (rc == 0) {
    printf("ru_utime    = %d.\n", usage.ru_utime);
    printf("ru_stime    = %d.\n", usage.ru_stime);
    printf("ru_maxrss   = %d.\n", usage.ru_maxrss);
    printf("ru_ixrss    = %d.\n", usage.ru_ixrss);
    printf("ru_idrss    = %d.\n", usage.ru_idrss);
    printf("ru_isrss    = %d.\n", usage.ru_isrss);
    printf("ru_minflt   = %d.\n", usage.ru_minflt);
    printf("ru_majflt   = %d.\n", usage.ru_majflt);
    printf("ru_nswap    = %d.\n", usage.ru_nswap);
    printf("ru_inblock  = %d.\n", usage.ru_inblock);
    printf("ru_oublock  = %d.\n", usage.ru_oublock);
    printf("ru_msgsnd   = %d.\n", usage.ru_msgsnd);
    printf("ru_msgrcv   = %d.\n", usage.ru_msgrcv);
    printf("ru_nsignals = %d.\n", usage.ru_nsignals);
    printf("ru_nvcsw    = %d.\n", usage.ru_nvcsw);
    printf("ru_niivcsw  = %d.\n", usage.ru_nivcsw);
  }
}


x86 assembly (clang, -O0):
<print_proc_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <getrusage@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4c(%rbp)
jne    1249 <print_proc_stats+0x129>
mov    -0x48(%rbp),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_proc_stats>:
push   %rbx
sub    $0x40,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1040 <getrusage@plt>
mov    %eax,%ebx
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
test   %ebx,%ebx
jne    124d <print_proc_stats+0x12d>
mov    (%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    0x34(%rsp),%esi
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
mov    0x3c(%rsp),%esi
lea    0xeef(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@RUSAGE_SELF = global i32 0
@.str = [26 x i8] c"getrusage() returned %d.\0A\00"
@.str.1 = [19 x i8] c"ru_utime = %d.\0A\00"
@.str.2 = [19 x i8] c"ru_stime = %d.\0A\00"
@.str.3 = [19 x i8] c"ru_maxrss = %d.\0A\00"
@.str.4 = [19 x i8] c"ru_ixrss = %d.\0A\00"
@.str.5 = [19 x i8] c"ru_idrss = %d.\0A\00"
@.str.6 = [19 x i8] c"ru_isrss = %d.\0A\00"
@.str.7 = [19 x i8] c"ru_minflt = %d.\0A\00"
@.str.8 = [19 x i8] c"ru_majflt = %d.\0A\00"
@.str.9 = [19 x i8] c"ru_nswap = %d.\0A\00"
@.str.10 = [19 x i8] c"ru_inblock = %d.\0A\00"
@.str.11 = [19 x i8] c"ru_oublock = %d.\0A\00"
@.str.12 = [19 x i8] c"ru_msgsnd = %d.\0A\00"
@.str.13 = [19 x i8] c"ru_msgrcv = %d.\0A\00"
@.str.14 = [19 x i8] c"ru_nsignals = %d.\0A\00"
@.str.15 = [19 x i8] c"ru_nvcsw = %d.\0A\00"
@.str.16 = [19 x i8] c"ru_niivcsw = %d.\0A\00"
define void @print_proc_stats(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.rusage
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @RUSAGE_SELF
%6 = call i32 @getrusage(i32 %5, %struct.rusage* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %60
11: ; preds = %1
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 1
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 2
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 3
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 4
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 5
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 6
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 7
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 8
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 9
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 10
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 11
%46 = load i32, i32* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 12
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 13
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 14
%55 = load i32, i32* %54
%56 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 15
%58 = load i32, i32* %57
%59 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
%struct.rusage = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@RUSAGE_SELF = global i32 0
@.str = [26 x i8] c"getrusage() returned %d.\0A\00"
@.str.1 = [19 x i8] c"ru_utime = %d.\0A\00"
@.str.2 = [19 x i8] c"ru_stime = %d.\0A\00"
@.str.3 = [19 x i8] c"ru_maxrss = %d.\0A\00"
@.str.4 = [19 x i8] c"ru_ixrss = %d.\0A\00"
@.str.5 = [19 x i8] c"ru_idrss = %d.\0A\00"
@.str.6 = [19 x i8] c"ru_isrss = %d.\0A\00"
@.str.7 = [19 x i8] c"ru_minflt = %d.\0A\00"
@.str.8 = [19 x i8] c"ru_majflt = %d.\0A\00"
@.str.9 = [19 x i8] c"ru_nswap = %d.\0A\00"
@.str.10 = [19 x i8] c"ru_inblock = %d.\0A\00"
@.str.11 = [19 x i8] c"ru_oublock = %d.\0A\00"
@.str.12 = [19 x i8] c"ru_msgsnd = %d.\0A\00"
@.str.13 = [19 x i8] c"ru_msgrcv = %d.\0A\00"
@.str.14 = [19 x i8] c"ru_nsignals = %d.\0A\00"
@.str.15 = [19 x i8] c"ru_nvcsw = %d.\0A\00"
@.str.16 = [19 x i8] c"ru_niivcsw = %d.\0A\00"
define void @print_proc_stats(i32 %0) {
%2 = alloca %struct.rusage
%3 = bitcast %struct.rusage* %2 to i8*
%4 = load i32, i32* @RUSAGE_SELF
%5 = call i32 @getrusage(i32 %4, %struct.rusage* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %57
8: ; preds = %1
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 2
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 3
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 4
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 5
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 6
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 7
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 8
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 9
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 10
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 11
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 12
%46 = load i32, i32* %45
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 13
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 14
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 15
%55 = load i32, i32* %54
%56 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %8, %1
ret void
}