#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__ EINVAL;
int /*<<< orphan*/ FSCONFIG_SET_BINARY;
int /*<<< orphan*/ FSCONFIG_SET_STRING;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int fsconfig(int, int /*<<< orphan*/, char *, ...);
int fsopen(char *, int /*<<< orphan*/);
int main(void) {
  int fsfd, ret;
  int hidepid = 2;
  assert((fsfd = fsopen("proc", 0)) != -1);
  ret = fsconfig(fsfd, FSCONFIG_SET_BINARY, "hidepid", &hidepid, 0);
  assert(ret == -1);
  assert(errno == EINVAL);
  assert(!fsconfig(fsfd, FSCONFIG_SET_STRING, "hidepid", "2", 0));
  assert(!fsconfig(fsfd, FSCONFIG_SET_STRING, "hidepid", "invisible", 0));
  assert(!close(fsfd));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x10(%rbp)
lea    0xea3(%rip),%rdi
xor    %esi,%esi
call   1030 <fsopen@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
lea    0xe7b(%rip),%rdx
lea    -0x10(%rbp),%rcx
xor    %r8d,%r8d
mov    $0x0,%al
call   1060 <fsconfig@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%rax
mov    0x2e13(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
mov    0x2df1(%rip),%rax
mov    (%rax),%esi
lea    0xe25(%rip),%rdx
lea    0xe26(%rip),%rcx
xor    %r8d,%r8d
mov    $0x0,%al
call   1060 <fsconfig@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
mov    0x2dbb(%rip),%rax
mov    (%rax),%esi
lea    0xdef(%rip),%rdx
lea    0xdf2(%rip),%rcx
xor    %r8d,%r8d
mov    $0x0,%al
call   1060 <fsconfig@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x2,0xc(%rsp)
lea    0xea8(%rip),%rdi
xor    %esi,%esi
call   1030 <fsopen@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   1050 <assert@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
lea    0xe86(%rip),%r14
lea    0xc(%rsp),%rcx
mov    %ebx,%edi
mov    %r14,%rdx
xor    %r8d,%r8d
xor    %eax,%eax
call   1060 <fsconfig@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%rax
mov    0x2e1e(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1050 <assert@plt>
mov    0x2e01(%rip),%r15
mov    (%r15),%esi
lea    0xe3c(%rip),%rcx
mov    %ebx,%edi
mov    %r14,%rdx
xor    %r8d,%r8d
xor    %eax,%eax
call   1060 <fsconfig@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%r15),%esi
lea    0xe18(%rip),%rcx
mov    %ebx,%edi
mov    %r14,%rdx
xor    %r8d,%r8d
xor    %eax,%eax
call   1060 <fsconfig@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"proc\00"
@FSCONFIG_SET_BINARY = global i32 0
@.str.1 = [8 x i8] c"hidepid\00"
@errno = global i64 0
@EINVAL = global i64 0
@FSCONFIG_SET_STRING = global i32 0
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [10 x i8] c"invisible\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %4
%5 = call i32 @fsopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %5, i32* %2
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %2
%10 = load i32, i32* @FSCONFIG_SET_BINARY
%11 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %9, i32 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32 0)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, -1
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i64, i64* @errno
%17 = load i64, i64* @EINVAL
%18 = icmp eq i64 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* %2
%22 = load i32, i32* @FSCONFIG_SET_STRING
%23 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %21, i32 %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %2
%29 = load i32, i32* @FSCONFIG_SET_STRING
%30 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %28, i32 %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load i32, i32* %2
%36 = call i32 @close(i32 %35)
%37 = icmp ne i32 %36, 0
%38 = xor i1 %37, true
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"proc\00"
@FSCONFIG_SET_BINARY = global i32 0
@.str.1 = [8 x i8] c"hidepid\00"
@errno = global i64 0
@EINVAL = global i64 0
@FSCONFIG_SET_STRING = global i32 0
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [10 x i8] c"invisible\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 2, i32* %1
%3 = tail call i32 @fsopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = load i32, i32* @FSCONFIG_SET_BINARY
%8 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %3, i32 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 0)
%9 = icmp eq i32 %8, -1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i64, i64* @errno
%13 = load i64, i64* @EINVAL
%14 = icmp eq i64 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* @FSCONFIG_SET_STRING
%18 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %3, i32 %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0)
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* @FSCONFIG_SET_STRING
%23 = call i32 (i32, i32, i8*, ...) @fsconfig(i32 %3, i32 %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i32 @close(i32 %3)
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret i32 0
}