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


x86 assembly (clang, -O0):
<sysconfPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
movq   $0x0,(%rax)
mov    -0xc(%rbp),%edi
call   1040 <sysconf@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    119d <sysconfPrint+0x6d>
mov    0x2e75(%rip),%rax
cmpq   $0x0,(%rax)
jne    118c <sysconfPrint+0x5c>
mov    -0x8(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <sysconfPrint+0x68>
lea    0xe81(%rip),%rdi
call   1050 <pexit@plt>
jmp    11b3 <sysconfPrint+0x83>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysconfPrint>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea2(%rip),%r14
movq   $0x0,(%r14)
mov    %esi,%edi
call   1040 <sysconf@plt>
cmp    $0xffffffffffffffff,%rax
je     116d <sysconfPrint+0x3d>
lea    0xec3(%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)
je     1186 <sysconfPrint+0x56>
lea    0xe9a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <pexit@plt>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.1 = [8 x i8] c"sysconf\00"
@.str.2 = [8 x i8] c"%s %ld\0A\00"
define void @sysconfPrint(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 eq i64 %8, -1
br i1 %9, label %10, label %19
10: ; preds = %2
%11 = load i64, i64* @errno
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %18
16: ; preds = %10
%17 = call i32 @pexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
br label %23
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = load i64, i64* %5
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %20, i64 %21)
br label %23
23: ; preds = %19, %18
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [20 x i8] c"%s (indeterminate)\0A\00"
@.str.1 = [8 x i8] c"sysconf\00"
@.str.2 = [8 x i8] c"%s %ld\0A\00"
define void @sysconfPrint(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 %5, label %12
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
10: ; preds = %5
%11 = tail call i32 @pexit(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %2
%13 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 %3)
br label %14
14: ; preds = %8, %10, %12
ret void
}