#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 rlimit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_AS;
int /*<<< orphan*/ RLIMIT_CORE;
int /*<<< orphan*/ RLIMIT_CPU;
int /*<<< orphan*/ RLIMIT_DATA;
int /*<<< orphan*/ RLIMIT_FSIZE;
int /*<<< orphan*/ RLIMIT_LOCKS;
int /*<<< orphan*/ RLIMIT_MEMLOCK;
int /*<<< orphan*/ RLIMIT_NOFILE;
int /*<<< orphan*/ RLIMIT_NPROC;
int /*<<< orphan*/ RLIMIT_RSS;
int /*<<< orphan*/ RLIMIT_STACK;
int /*<<< orphan*/ do_limit(int /*<<< orphan*/, char *, struct rlimit *);
void print_limits(void) {
  struct rlimit rlim;
  do_limit(RLIMIT_CPU, "RLIMIT_CPU", &rlim);
  do_limit(RLIMIT_FSIZE, "RLMIT_FSIZE", &rlim);
  do_limit(RLIMIT_DATA, "RLMIT_DATA", &rlim);
  do_limit(RLIMIT_STACK, "RLIMIT_STACK", &rlim);
  do_limit(RLIMIT_CORE, "RLIMIT_CORE", &rlim);
  do_limit(RLIMIT_RSS, "RLIMIT_RSS", &rlim);
  do_limit(RLIMIT_NPROC, "RLIMIT_NPROC", &rlim);
  do_limit(RLIMIT_NOFILE, "RLIMIT_NOFILE", &rlim);
  do_limit(RLIMIT_MEMLOCK, "RLIMIT_MEMLOCK", &rlim);
  do_limit(RLIMIT_AS, "RLIMIT_AS", &rlim);
  do_limit(RLIMIT_LOCKS, "RLIMIT_LOCKS", &rlim);
}


x86 assembly (clang, -O0):
<print_limits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <do_limit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_limits>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xedb(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    %rbx,%rdx
call   1030 <do_limit@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@RLIMIT_CPU = global i32 0
@.str = [11 x i8] c"RLIMIT_CPU\00"
@RLIMIT_FSIZE = global i32 0
@.str.1 = [12 x i8] c"RLMIT_FSIZE\00"
@RLIMIT_DATA = global i32 0
@.str.2 = [11 x i8] c"RLMIT_DATA\00"
@RLIMIT_STACK = global i32 0
@.str.3 = [13 x i8] c"RLIMIT_STACK\00"
@RLIMIT_CORE = global i32 0
@.str.4 = [12 x i8] c"RLIMIT_CORE\00"
@RLIMIT_RSS = global i32 0
@.str.5 = [11 x i8] c"RLIMIT_RSS\00"
@RLIMIT_NPROC = global i32 0
@.str.6 = [13 x i8] c"RLIMIT_NPROC\00"
@RLIMIT_NOFILE = global i32 0
@.str.7 = [14 x i8] c"RLIMIT_NOFILE\00"
@RLIMIT_MEMLOCK = global i32 0
@.str.8 = [15 x i8] c"RLIMIT_MEMLOCK\00"
@RLIMIT_AS = global i32 0
@.str.9 = [10 x i8] c"RLIMIT_AS\00"
@RLIMIT_LOCKS = global i32 0
@.str.10 = [13 x i8] c"RLIMIT_LOCKS\00"
define void @print_limits() {
%1 = alloca %struct.rlimit
%2 = load i32, i32* @RLIMIT_CPU
%3 = call i32 @do_limit(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.rlimit* %1)
%4 = load i32, i32* @RLIMIT_FSIZE
%5 = call i32 @do_limit(i32 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.rlimit* %1)
%6 = load i32, i32* @RLIMIT_DATA
%7 = call i32 @do_limit(i32 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %struct.rlimit* %1)
%8 = load i32, i32* @RLIMIT_STACK
%9 = call i32 @do_limit(i32 %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %struct.rlimit* %1)
%10 = load i32, i32* @RLIMIT_CORE
%11 = call i32 @do_limit(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), %struct.rlimit* %1)
%12 = load i32, i32* @RLIMIT_RSS
%13 = call i32 @do_limit(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %struct.rlimit* %1)
%14 = load i32, i32* @RLIMIT_NPROC
%15 = call i32 @do_limit(i32 %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), %struct.rlimit* %1)
%16 = load i32, i32* @RLIMIT_NOFILE
%17 = call i32 @do_limit(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %struct.rlimit* %1)
%18 = load i32, i32* @RLIMIT_MEMLOCK
%19 = call i32 @do_limit(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %struct.rlimit* %1)
%20 = load i32, i32* @RLIMIT_AS
%21 = call i32 @do_limit(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), %struct.rlimit* %1)
%22 = load i32, i32* @RLIMIT_LOCKS
%23 = call i32 @do_limit(i32 %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %struct.rlimit* %1)
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@RLIMIT_CPU = global i32 0
@.str = [11 x i8] c"RLIMIT_CPU\00"
@RLIMIT_FSIZE = global i32 0
@.str.1 = [12 x i8] c"RLMIT_FSIZE\00"
@RLIMIT_DATA = global i32 0
@.str.2 = [11 x i8] c"RLMIT_DATA\00"
@RLIMIT_STACK = global i32 0
@.str.3 = [13 x i8] c"RLIMIT_STACK\00"
@RLIMIT_CORE = global i32 0
@.str.4 = [12 x i8] c"RLIMIT_CORE\00"
@RLIMIT_RSS = global i32 0
@.str.5 = [11 x i8] c"RLIMIT_RSS\00"
@RLIMIT_NPROC = global i32 0
@.str.6 = [13 x i8] c"RLIMIT_NPROC\00"
@RLIMIT_NOFILE = global i32 0
@.str.7 = [14 x i8] c"RLIMIT_NOFILE\00"
@RLIMIT_MEMLOCK = global i32 0
@.str.8 = [15 x i8] c"RLIMIT_MEMLOCK\00"
@RLIMIT_AS = global i32 0
@.str.9 = [10 x i8] c"RLIMIT_AS\00"
@RLIMIT_LOCKS = global i32 0
@.str.10 = [13 x i8] c"RLIMIT_LOCKS\00"
define void @print_limits() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_CPU
%4 = call i32 @do_limit(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.rlimit* %1)
%5 = load i32, i32* @RLIMIT_FSIZE
%6 = call i32 @do_limit(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.rlimit* %1)
%7 = load i32, i32* @RLIMIT_DATA
%8 = call i32 @do_limit(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %struct.rlimit* %1)
%9 = load i32, i32* @RLIMIT_STACK
%10 = call i32 @do_limit(i32 %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %struct.rlimit* %1)
%11 = load i32, i32* @RLIMIT_CORE
%12 = call i32 @do_limit(i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), %struct.rlimit* %1)
%13 = load i32, i32* @RLIMIT_RSS
%14 = call i32 @do_limit(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %struct.rlimit* %1)
%15 = load i32, i32* @RLIMIT_NPROC
%16 = call i32 @do_limit(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), %struct.rlimit* %1)
%17 = load i32, i32* @RLIMIT_NOFILE
%18 = call i32 @do_limit(i32 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), %struct.rlimit* %1)
%19 = load i32, i32* @RLIMIT_MEMLOCK
%20 = call i32 @do_limit(i32 %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %struct.rlimit* %1)
%21 = load i32, i32* @RLIMIT_AS
%22 = call i32 @do_limit(i32 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), %struct.rlimit* %1)
%23 = load i32, i32* @RLIMIT_LOCKS
%24 = call i32 @do_limit(i32 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), %struct.rlimit* %1)
ret void
}