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

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_STACK;
int /*<<< orphan*/ RLIM_INFINITY;
scalar_t__ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int main() {
  struct rlimit rlim;
  if (0 == getrlimit(RLIMIT_STACK, &rlim)) {
    printf("%-15s", "RLIMIT_STACK");
    if (RLIM_INFINITY == rlim.rlim_cur)
      printf("(infinite)");
    else
      printf("%-15ld", rlim.rlim_cur);
    if (RLIM_INFINITY == rlim.rlim_max)
      printf("(infinite)");
    else
      printf("%-15ld", rlim.rlim_max);
    rlim.rlim_cur = rlim.rlim_max;
    setrlimit(RLIMIT_STACK, &rlim);
  }
  printf("\n");
  if (0 == getrlimit(RLIMIT_STACK, &rlim)) {
    printf("%-15s", "RLIMIT_STACK");
    if (RLIM_INFINITY == rlim.rlim_cur)
      printf("(infinite)");
    else
      printf("%-15ld", rlim.rlim_cur);
    if (RLIM_INFINITY == rlim.rlim_max)
      printf("(infinite)");
    else
      printf("%-15ld", rlim.rlim_max);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11f8 <main+0xc8>
lea    0xe9a(%rip),%rdi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1199 <main+0x69>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11aa <main+0x7a>
mov    -0xc(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
cmp    -0x10(%rbp),%eax
jne    11cf <main+0x9f>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e0 <main+0xb0>
mov    -0x10(%rbp),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1040 <setrlimit@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1050 <getrlimit@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    12ac <main+0x17c>
lea    0xdd3(%rip),%rdi
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1260 <main+0x130>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <main+0x141>
mov    -0xc(%rbp),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
cmp    -0x10(%rbp),%eax
jne    1296 <main+0x166>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <main+0x177>
mov    -0x10(%rbp),%esi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x17c>
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e95(%rip),%rbx
mov    (%rbx),%edi
mov    %rsp,%rsi
call   1060 <getrlimit@plt>
test   %rax,%rax
jne    11d4 <main+0x94>
lea    0xe9f(%rip),%rdi
lea    0xe9e(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e62(%rip),%r14
mov    0x4(%rsp),%esi
cmp    %esi,(%r14)
jne    118f <main+0x4f>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    119d <main+0x5d>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
cmp    %esi,(%r14)
jne    11b5 <main+0x75>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c3 <main+0x83>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
mov    (%rbx),%edi
mov    %rsp,%rsi
call   1050 <setrlimit@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rbx),%edi
mov    %rsp,%rsi
call   1060 <getrlimit@plt>
test   %rax,%rax
jne    1254 <main+0x114>
lea    0xe0c(%rip),%rdi
lea    0xe0b(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2dcf(%rip),%rbx
mov    0x4(%rsp),%esi
cmp    %esi,(%rbx)
jne    1221 <main+0xe1>
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    122f <main+0xef>
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
cmp    %esi,(%rbx)
jne    1246 <main+0x106>
lea    0xdd6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1254 <main+0x114>
lea    0xdd1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_STACK = global i32 0
@.str = [6 x i8] c"%-15s\00"
@.str.1 = [13 x i8] c"RLIMIT_STACK\00"
@RLIM_INFINITY = global i32 0
@.str.2 = [11 x i8] c"(infinite)\00"
@.str.3 = [7 x i8] c"%-15ld\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rlimit
store i32 0, i32* %1
%3 = load i32, i32* @RLIMIT_STACK
%4 = call i64 @getrlimit(i32 %3, %struct.rlimit* %2)
%5 = icmp eq i64 0, %4
br i1 %5, label %6, label %35
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @RLIM_INFINITY
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %18
14: ; preds = %6
%15 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %12
%19 = load i32, i32* @RLIM_INFINITY
%20 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%21 = load i32, i32* %20
%22 = icmp eq i32 %19, %21
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %29
25: ; preds = %18
%26 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25, %23
%30 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
store i32 %31, i32* %32
%33 = load i32, i32* @RLIMIT_STACK
%34 = call i32 @setrlimit(i32 %33, %struct.rlimit* %2)
br label %35
35: ; preds = %29, %0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%37 = load i32, i32* @RLIMIT_STACK
%38 = call i64 @getrlimit(i32 %37, %struct.rlimit* %2)
%39 = icmp eq i64 0, %38
br i1 %39, label %40, label %64
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%42 = load i32, i32* @RLIM_INFINITY
%43 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
%44 = load i32, i32* %43
%45 = icmp eq i32 %42, %44
br i1 %45, label %46, label %48
46: ; preds = %40
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %52
48: ; preds = %40
%49 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 1
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %48, %46
%53 = load i32, i32* @RLIM_INFINITY
%54 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%55 = load i32, i32* %54
%56 = icmp eq i32 %53, %55
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %63
59: ; preds = %52
%60 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %59, %57
br label %64
64: ; preds = %63, %35
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_STACK = global i32 0
@.str = [6 x i8] c"%-15s\00"
@.str.1 = [13 x i8] c"RLIMIT_STACK\00"
@RLIM_INFINITY = global i32 0
@.str.2 = [11 x i8] c"(infinite)\00"
@.str.3 = [7 x i8] c"%-15ld\00"
define i32 @main() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_STACK
%4 = call i64 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %29
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @RLIM_INFINITY
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %6
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %10)
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* @RLIM_INFINITY
%18 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%19 = load i32, i32* %18
%20 = icmp eq i32 %17, %19
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %25
23: ; preds = %16
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %25
25: ; preds = %23, %21
%26 = load i32, i32* %18
store i32 %26, i32* %9
%27 = load i32, i32* @RLIMIT_STACK
%28 = call i32 @setrlimit(i32 %27, %struct.rlimit* %1)
br label %29
29: ; preds = %25, %0
%30 = call i32 @putchar(i32 10)
%31 = load i32, i32* @RLIMIT_STACK
%32 = call i64 @getrlimit(i32 %31, %struct.rlimit* %1)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %53
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* @RLIM_INFINITY
%37 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
%38 = load i32, i32* %37
%39 = icmp eq i32 %36, %38
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %44
42: ; preds = %34
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %44
44: ; preds = %42, %40
%45 = load i32, i32* @RLIM_INFINITY
%46 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%47 = load i32, i32* %46
%48 = icmp eq i32 %45, %47
br i1 %48, label %49, label %51
49: ; preds = %44
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %53
51: ; preds = %44
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %47)
br label %53
53: ; preds = %49, %51, %29
%54 = call i32 @putchar(i32 10)
ret i32 0
}