#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 rlim_cur;
  int rlim_max;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_CPU;
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int setLimit(int nuo, int iki) {
  struct rlimit rl;
  getrlimit(RLIMIT_CPU, &rl);
  printf("Get:\tRLIMIT_CPU %ld (soft) %ld (hard)\n", rl.rlim_cur, rl.rlim_max);
  rl.rlim_cur = nuo;
  rl.rlim_max = iki;
  setrlimit(RLIMIT_CPU, &rl);
  getrlimit(RLIMIT_CPU, &rl);
  printf("Set:\tRLIMIT_CPU %ld (soft) %ld (hard)\n", rl.rlim_cur, rl.rlim_max);
}


x86 assembly (clang, -O0):
<setLimit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setLimit>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e96(%rip),%r15
mov    (%r15),%edi
mov    %rsp,%r14
mov    %r14,%rsi
call   1050 <getrlimit@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    %ebp,(%rsp)
mov    %ebx,0x4(%rsp)
mov    (%r15),%edi
mov    %r14,%rsi
call   1040 <setrlimit@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1050 <getrlimit@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CPU = global i32 0
@.str = [39 x i8] c"Get:\09RLIMIT_CPU %ld (soft) %ld (hard)\0A\00"
@.str.1 = [39 x i8] c"Set:\09RLIMIT_CPU %ld (soft) %ld (hard)\0A\00"
define i32 @setLimit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.rlimit
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* @RLIMIT_CPU
%8 = call i32 @getrlimit(i32 %7, %struct.rlimit* %6)
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i32, i32* %4
%15 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 %14, i32* %15
%16 = load i32, i32* %5
%17 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
store i32 %16, i32* %17
%18 = load i32, i32* @RLIMIT_CPU
%19 = call i32 @setrlimit(i32 %18, %struct.rlimit* %6)
%20 = load i32, i32* @RLIMIT_CPU
%21 = call i32 @getrlimit(i32 %20, %struct.rlimit* %6)
%22 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %25)
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CPU = global i32 0
@.str = [39 x i8] c"Get:\09RLIMIT_CPU %ld (soft) %ld (hard)\0A\00"
@.str.1 = [39 x i8] c"Set:\09RLIMIT_CPU %ld (soft) %ld (hard)\0A\00"
define i32 @setLimit(i32 %0, i32 %1) {
%3 = alloca %struct.rlimit
%4 = bitcast %struct.rlimit* %3 to i8*
%5 = load i32, i32* @RLIMIT_CPU
%6 = call i32 @getrlimit(i32 %5, %struct.rlimit* %3)
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
store i32 %0, i32* %7
store i32 %1, i32* %9
%12 = load i32, i32* @RLIMIT_CPU
%13 = call i32 @setrlimit(i32 %12, %struct.rlimit* %3)
%14 = load i32, i32* @RLIMIT_CPU
%15 = call i32 @getrlimit(i32 %14, %struct.rlimit* %3)
%16 = load i32, i32* %7
%17 = load i32, i32* %9
%18 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
ret i32 undef
}