#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*/ RLIMIT_FSIZE;
int /*<<< orphan*/ RLIMIT_MEMLOCK;
int /*<<< orphan*/ RLIMIT_NOFILE;
int /*<<< orphan*/ RLIMIT_NPROC;
int /*<<< orphan*/ alarm(int);
int execvp(char *, char **);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int main(int argc, char *argv[]) {
  struct rlimit limit;
  limit.rlim_cur = 24;
  limit.rlim_max = 24;
  setrlimit(RLIMIT_CPU, &limit);
  limit.rlim_cur = 16384;
  limit.rlim_max = 16384;
  setrlimit(RLIMIT_NPROC, &limit);
  limit.rlim_cur = 16384;
  limit.rlim_max = 16384;
  setrlimit(RLIMIT_NOFILE, &limit);
  limit.rlim_cur = 549747425280;
  limit.rlim_max = 549747425280;
  setrlimit(RLIMIT_FSIZE, &limit);
  setrlimit(RLIMIT_MEMLOCK, &limit);
  alarm(24);
  return execvp(argv[1], &argv[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x18,-0x18(%rbp)
movl   $0x18,-0x14(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
movl   $0x4000,-0x18(%rbp)
movl   $0x4000,-0x14(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
movl   $0x4000,-0x18(%rbp)
movl   $0x4000,-0x14(%rbp)
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
movl   $0xff800000,-0x18(%rbp)
movl   $0xff800000,-0x14(%rbp)
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1040 <setrlimit@plt>
mov    $0x18,%edi
call   1030 <alarm@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <execvp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movabs $0x1800000018,%rax
mov    %rax,0x8(%rsp)
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1040 <setrlimit@plt>
movabs $0x400000004000,%r15
mov    %r15,0x8(%rsp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1040 <setrlimit@plt>
mov    %r15,0x8(%rsp)
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1040 <setrlimit@plt>
movabs $0xff800000ff800000,%rax
mov    %rax,0x8(%rsp)
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1040 <setrlimit@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1040 <setrlimit@plt>
mov    $0x18,%edi
call   1030 <alarm@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
mov    %rbx,%rsi
call   1050 <execvp@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CPU = global i32 0
@RLIMIT_NPROC = global i32 0
@RLIMIT_NOFILE = global i32 0
@RLIMIT_FSIZE = global i32 0
@RLIMIT_MEMLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.rlimit
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 24, i32* %7
%8 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
store i32 24, i32* %8
%9 = load i32, i32* @RLIMIT_CPU
%10 = call i32 @setrlimit(i32 %9, %struct.rlimit* %6)
%11 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 16384, i32* %11
%12 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
store i32 16384, i32* %12
%13 = load i32, i32* @RLIMIT_NPROC
%14 = call i32 @setrlimit(i32 %13, %struct.rlimit* %6)
%15 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 16384, i32* %15
%16 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
store i32 16384, i32* %16
%17 = load i32, i32* @RLIMIT_NOFILE
%18 = call i32 @setrlimit(i32 %17, %struct.rlimit* %6)
%19 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 -8388608, i32* %19
%20 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 1
store i32 -8388608, i32* %20
%21 = load i32, i32* @RLIMIT_FSIZE
%22 = call i32 @setrlimit(i32 %21, %struct.rlimit* %6)
%23 = load i32, i32* @RLIMIT_MEMLOCK
%24 = call i32 @setrlimit(i32 %23, %struct.rlimit* %6)
%25 = call i32 @alarm(i32 24)
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = call i32 @execvp(i8* %28, i8** %30)
ret i32 %31
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CPU = global i32 0
@RLIMIT_NPROC = global i32 0
@RLIMIT_NOFILE = global i32 0
@RLIMIT_FSIZE = global i32 0
@RLIMIT_MEMLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.rlimit
%4 = bitcast %struct.rlimit* %3 to i8*
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
store i32 24, i32* %5
%6 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 1
store i32 24, i32* %6
%7 = load i32, i32* @RLIMIT_CPU
%8 = call i32 @setrlimit(i32 %7, %struct.rlimit* %3)
store i32 16384, i32* %5
store i32 16384, i32* %6
%9 = load i32, i32* @RLIMIT_NPROC
%10 = call i32 @setrlimit(i32 %9, %struct.rlimit* %3)
store i32 16384, i32* %5
store i32 16384, i32* %6
%11 = load i32, i32* @RLIMIT_NOFILE
%12 = call i32 @setrlimit(i32 %11, %struct.rlimit* %3)
store i32 -8388608, i32* %5
store i32 -8388608, i32* %6
%13 = load i32, i32* @RLIMIT_FSIZE
%14 = call i32 @setrlimit(i32 %13, %struct.rlimit* %3)
%15 = load i32, i32* @RLIMIT_MEMLOCK
%16 = call i32 @setrlimit(i32 %15, %struct.rlimit* %3)
%17 = call i32 @alarm(i32 24)
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @execvp(i8* %19, i8** %18)
ret i32 %20
}