#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 {
  scalar_t__ ru_inblock;
  scalar_t__ ru_oublock;
  scalar_t__ ru_maxrss;
};
typedef int /*<<< orphan*/ r;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ memset(struct rusage *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int, int, int);
void lsmtest_rusage_report(void) {
  struct rusage r;
  memset(&r, 0, sizeof(r));
  getrusage(RUSAGE_SELF, &r);
  printf("# getrusage: { ru_maxrss %d ru_oublock %d ru_inblock %d }\n",
         (int)r.ru_maxrss, (int)r.ru_oublock, (int)r.ru_inblock);
}


x86 assembly (clang, -O0):
<lsmtest_rusage_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1050 <getrusage@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsmtest_rusage_report>:
push   %rbx
sub    $0x20,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1050 <getrusage@plt>
mov    0x18(%rsp),%esi
mov    0x8(%rsp),%ecx
mov    0x10(%rsp),%edx
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { i64, i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [59 x i8] c"# getrusage: { ru_maxrss %d ru_oublock %d ru_inblock %d }\0A\00"
define void @lsmtest_rusage_report() {
%1 = alloca %struct.rusage
%2 = call i32 @memset(%struct.rusage* %1, i32 0, i32 24)
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i32 @getrusage(i32 %3, %struct.rusage* %1)
%5 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 2
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 1
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.rusage = type { i64, i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [59 x i8] c"# getrusage: { ru_maxrss %d ru_oublock %d ru_inblock %d }\0A\00"
define void @lsmtest_rusage_report() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
%3 = call i32 @memset(%struct.rusage* %1, i32 0, i32 24)
%4 = load i32, i32* @RUSAGE_SELF
%5 = call i32 @getrusage(i32 %4, %struct.rusage* %1)
%6 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 2
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14)
ret void
}