#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 {
  unsigned long rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_STACK;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
void fprintf(int /*<<< orphan*/, char *, ...);
int getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ stderr;
unsigned long int Get_System_Stack_Limit(void) {
  struct rlimit cur_rlimit;
  int return_value;
  return_value = getrlimit(RLIMIT_STACK, &cur_rlimit);
  (return_value == 0
       ? (void)1
       : (fprintf(stderr, "Assertion Failed at %s:%d ",
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/pumpkin83/OpenUH-OpenACC/"
                  "refs/heads/master/osprey/libopenmp/omp_util.c",
                  84),
          fprintf(stderr, ("user stack limit setting wrong")),
          fprintf(stderr, "\n"), fflush(stderr), abort(), (void)0));
  return cur_rlimit.rlim_cur;
}


x86 assembly (clang, -O0):
<Get_System_Stack_Limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1060 <getrlimit@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    116c <Get_System_Stack_Limit+0x2c>
jmp    11d2 <Get_System_Stack_Limit+0x92>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
lea    0xe98(%rip),%rdx
mov    $0x54,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xf1d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    0xf25(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_System_Stack_Limit>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1060 <getrlimit@plt>
test   %eax,%eax
jne    1167 <Get_System_Stack_Limit+0x27>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e72(%rip),%rbx
mov    (%rbx),%edi
lea    0xe89(%rip),%rsi
lea    0xe9d(%rip),%rdx
mov    $0x54,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf29(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf38(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.rlimit = type { i64 }
@RLIMIT_STACK = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Assertion Failed at %s:%d \00"
@.str.1 = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pumpkin83/OpenUH-OpenACC/refs/heads/master/osprey/libopenmp/omp_util.c\00"
@.str.2 = [31 x i8] c"user stack limit setting wrong\00"
@.str.3 = [2 x i8] c"\0A\00"
define i64 @Get_System_Stack_Limit() {
%1 = alloca %struct.rlimit
%2 = alloca i32
%3 = load i32, i32* @RLIMIT_STACK
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %16
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i32, i32* @stderr
%11 = load i32, i32* @stderr
%12 = load i32, i32* @stderr
%13 = call i32 @fflush(i32 %12)
%14 = call i32 (...) @abort()
unreachable
15: ; No predecessors!
br label %16
16: ; preds = %15, %7
%17 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
%18 = load i64, i64* %17
ret i64 %18
}

LLVM IR (-O2):
%struct.rlimit = type { i64 }
@RLIMIT_STACK = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Assertion Failed at %s:%d \00"
@.str.1 = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pumpkin83/OpenUH-OpenACC/refs/heads/master/osprey/libopenmp/omp_util.c\00"
@.str.2 = [31 x i8] c"user stack limit setting wrong\00"
@.str.3 = [2 x i8] c"\0A\00"
define i64 @Get_System_Stack_Limit() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_STACK
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* @stderr
%9 = load i32, i32* @stderr
%10 = load i32, i32* @stderr
%11 = call i32 @fflush(i32 %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %0
%14 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%15 = load i64, i64* %14
ret i64 %15
}