#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 */

/* Variables and functions */
int /*<<< orphan*/ UL_GETFSIZE;
int /*<<< orphan*/ UL_SETFSIZE;
int /*<<< orphan*/ printf(char *, long);
long ulimit(int /*<<< orphan*/, ...);
int main(void) {
  int retval = 0;
  long int res;
  res = ulimit(UL_SETFSIZE, 10000);
  printf("Result of ulimit (UL_SETFSIZE, 10000): %ld\n", res);
  if (res != 10000)
    retval = 1;
  res = ulimit(UL_GETFSIZE);
  printf("Result of ulimit(UL_GETFSIZE): %ld\n", res);
  if (res != 10000)
    retval = 1;
  return retval;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    $0x2710,%esi
mov    $0x0,%al
call   1040 <ulimit@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x2710,-0x10(%rbp)
je     1174 <main+0x54>
movl   $0x1,-0x8(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1040 <ulimit@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x2710,-0x10(%rbp)
je     11ad <main+0x8d>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    $0x2710,%esi
xor    %eax,%eax
call   1040 <ulimit@plt>
mov    %rax,%r14
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    $0x2710,%r14
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
call   1040 <ulimit@plt>
mov    %rax,%rbx
lea    0xec0(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    $0x2710,%rbx
xor    %eax,%eax
or     %r14,%rbx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@UL_SETFSIZE = global i32 0
@.str = [44 x i8] c"Result of ulimit (UL_SETFSIZE, 10000): %ld\0A\00"
@UL_GETFSIZE = global i32 0
@.str.1 = [36 x i8] c"Result of ulimit(UL_GETFSIZE): %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* @UL_SETFSIZE
%5 = call i64 (i32, ...) @ulimit(i32 %4, i32 10000)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = load i64, i64* %3
%9 = icmp ne i64 %8, 10000
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 1, i32* %2
br label %11
11: ; preds = %10, %0
%12 = load i32, i32* @UL_GETFSIZE
%13 = call i64 (i32, ...) @ulimit(i32 %12)
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %3
%17 = icmp ne i64 %16, 10000
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 1, i32* %2
br label %19
19: ; preds = %18, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@UL_SETFSIZE = global i32 0
@.str = [44 x i8] c"Result of ulimit (UL_SETFSIZE, 10000): %ld\0A\00"
@UL_GETFSIZE = global i32 0
@.str.1 = [36 x i8] c"Result of ulimit(UL_GETFSIZE): %ld\0A\00"
define i32 @main() {
%1 = load i32, i32* @UL_SETFSIZE
%2 = tail call i64 (i32, ...) @ulimit(i32 %1, i32 10000)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = icmp ne i64 %2, 10000
%5 = load i32, i32* @UL_GETFSIZE
%6 = tail call i64 (i32, ...) @ulimit(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i64 %6)
%8 = icmp ne i64 %6, 10000
%9 = or i1 %4, %8
%10 = zext i1 %9 to i32
ret i32 %10
}