#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 */
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char const *, ...);
long sysconf(int);
void pr_sysconf(const char *msg, int name) {
  long lim;
  errno = 0;
  lim = sysconf(name);
  if (lim != -1) {
    printf("%s %ld\n", msg, lim);
  } else {
    if (errno == 0) {
      printf("%s (indeterminate)\n", msg);
    } else {
      perror("sysconf error");
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<pr_sysconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e8a(%rip),%rax
movq   $0x0,(%rax)
mov    -0xc(%rbp),%edi
call   1050 <sysconf@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
je     118f <pr_sysconf+0x4f>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <pr_sysconf+0x92>
mov    0x2e4a(%rip),%rax
cmpq   $0x0,(%rax)
jne    11b7 <pr_sysconf+0x77>
mov    -0x8(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cd <pr_sysconf+0x8d>
lea    0xe5e(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11d2 <pr_sysconf+0x92>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_sysconf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e92(%rip),%r14
movq   $0x0,(%r14)
mov    %esi,%edi
call   1050 <sysconf@plt>
cmp    $0xffffffffffffffff,%rax
je     117d <pr_sysconf+0x3d>
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
cmpq   $0x0,(%r14)
jne    119b <pr_sysconf+0x5b>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [8 x i8] c"%s %ld\0A\00"
@.str.1 = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.2 = [14 x i8] c"sysconf error\00"
define void @pr_sysconf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
store i64 0, i64* @errno
%6 = load i32, i32* %4
%7 = call i64 @sysconf(i32 %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = icmp ne i64 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i64, i64* %5
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %11, i64 %12)
br label %24
14: ; preds = %2
%15 = load i64, i64* @errno
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %3
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %14
%21 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %17
br label %24
24: ; preds = %23, %10
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [8 x i8] c"%s %ld\0A\00"
@.str.1 = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.2 = [14 x i8] c"sysconf error\00"
define void @pr_sysconf(i8* %0, i32 %1) {
store i64 0, i64* @errno
%3 = tail call i64 @sysconf(i32 %1)
%4 = icmp eq i64 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %3)
br label %15
7: ; preds = %2
%8 = load i64, i64* @errno
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %15
12: ; preds = %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %10, %5
ret void
}