#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(scalar_t__);
long sysconf(int);
void pr_sysconf(char *mesg, int name) {
  long val;
  fputs(mesg, stdout);
  errno = 0;
  if ((val = sysconf(name)) < 0) {
    if (errno != 0) {
      (void)fprintf(stderr, "sysconf error : %s\n", strerror(errno));
      exit(1);
    }
    fputs(" (not defined)\n", stdout);
  } else
    printf(" %ld\n", val);
}


x86 assembly (clang, -O0):
<pr_sysconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    0x2e50(%rip),%rax
movq   $0x0,(%rax)
mov    -0xc(%rbp),%edi
call   1060 <sysconf@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jge    1207 <pr_sysconf+0xa7>
mov    0x2e2c(%rip),%rax
cmpq   $0x0,(%rax)
je     11ed <pr_sysconf+0x8d>
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%rdi
call   1080 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe22(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
lea    0xe17(%rip),%rdi
call   1040 <fputs@plt>
jmp    1217 <pr_sysconf+0xb7>
mov    -0x18(%rbp),%rsi
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_sysconf>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    0x2e62(%rip),%r14
mov    (%r14),%esi
call   1040 <fputs@plt>
mov    0x2e5b(%rip),%r15
movq   $0x0,(%r15)
mov    %ebx,%edi
call   1060 <sysconf@plt>
test   %rax,%rax
js     11a4 <pr_sysconf+0x44>
lea    0xe8d(%rip),%rdi
mov    %rax,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
mov    (%r15),%rdi
test   %rdi,%rdi
jne    11c0 <pr_sysconf+0x60>
mov    (%r14),%esi
lea    0xe5e(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fputs@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%ebx
call   1080 <strerror@plt>
lea    0xe2b(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@errno = global i64 0
@stderr = global i32 0
@.str = [20 x i8] c"sysconf error : %s\0A\00"
@.str.1 = [16 x i8] c" (not defined)\0A\00"
@.str.2 = [6 x i8] c" %ld\0A\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
%6 = load i8*, i8** %3
%7 = load i32, i32* @stdout
%8 = call i32 @fputs(i8* %6, i32 %7)
store i64 0, i64* @errno
%9 = load i32, i32* %4
%10 = call i64 @sysconf(i32 %9)
store i64 %10, i64* %5
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %2
%13 = load i64, i64* @errno
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = load i64, i64* @errno
%18 = call i8* @strerror(i64 %17)
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %12
%22 = load i32, i32* @stdout
%23 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %27
24: ; preds = %2
%25 = load i64, i64* %5
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %25)
br label %27
27: ; preds = %24, %21
ret void
}

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