#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int fts_instr;
};
typedef TYPE_1__ FTSENT;
typedef int /*<<< orphan*/ FTS;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int FTS_AGAIN;
int FTS_FOLLOW;
int FTS_NOINSTR;
int FTS_SKIP;
int /*<<< orphan*/ errno;
int fts_set(FTS *sp, FTSENT *p, int instr) {
  ;
  ;
  if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
      instr != FTS_NOINSTR && instr != FTS_SKIP) {
    errno = EINVAL;
    return (1);
  }
  p->fts_instr = instr;
  return (0);
}


x86 assembly (clang, -O0):
<fts_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     117f <fts_set+0x7f>
mov    -0x1c(%rbp),%eax
mov    0x2ec5(%rip),%rcx
cmp    (%rcx),%eax
je     117f <fts_set+0x7f>
mov    -0x1c(%rbp),%eax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%eax
je     117f <fts_set+0x7f>
mov    -0x1c(%rbp),%eax
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%eax
je     117f <fts_set+0x7f>
mov    -0x1c(%rbp),%eax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%eax
je     117f <fts_set+0x7f>
mov    0x2e50(%rip),%rax
mov    (%rax),%ecx
mov    0x2e57(%rip),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    118f <fts_set+0x8f>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts_set>:
test   %edx,%edx
je     1148 <fts_set+0x48>
mov    0x2edd(%rip),%rax
cmp    %edx,(%rax)
je     1148 <fts_set+0x48>
mov    0x2ee2(%rip),%rax
cmp    %edx,(%rax)
je     1148 <fts_set+0x48>
mov    0x2e9f(%rip),%rax
cmp    %edx,(%rax)
je     1148 <fts_set+0x48>
mov    0x2eac(%rip),%rax
cmp    %edx,(%rax)
je     1148 <fts_set+0x48>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    0x2e88(%rip),%rcx
mov    %eax,(%rcx)
mov    $0x1,%eax
ret
mov    %edx,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@FTS_AGAIN = global i32 0
@FTS_FOLLOW = global i32 0
@FTS_NOINSTR = global i32 0
@FTS_SKIP = global i32 0
@EINVAL = global i32 0
@errno = global i32 0
define i32 @fts_set(i32* %0, %struct.TYPE_3__* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.TYPE_3__*
%7 = alloca i32
store i32* %0, i32** %5
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %28
10: ; preds = %3
%11 = load i32, i32* %7
%12 = load i32, i32* @FTS_AGAIN
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i32, i32* %7
%16 = load i32, i32* @FTS_FOLLOW
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i32, i32* %7
%20 = load i32, i32* @FTS_NOINSTR
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i32, i32* %7
%24 = load i32, i32* @FTS_SKIP
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* @EINVAL
store i32 %27, i32* @errno
store i32 1, i32* %4
br label %32
28: ; preds = %22, %18, %14, %10, %3
%29 = load i32, i32* %7
%30 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %30, i32 0, i32 0
store i32 %29, i32* %31
store i32 0, i32* %4
br label %32
32: ; preds = %28, %26
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@FTS_AGAIN = global i32 0
@FTS_FOLLOW = global i32 0
@FTS_NOINSTR = global i32 0
@FTS_SKIP = global i32 0
@EINVAL = global i32 0
@errno = global i32 0
define i32 @fts_set(i32* nocapture readnone %0, %struct.TYPE_3__* nocapture writeonly %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = load i32, i32* @FTS_AGAIN
%6 = icmp eq i32 %5, %2
%7 = select i1 %4, i1 true, i1 %6
%8 = load i32, i32* @FTS_FOLLOW
%9 = icmp eq i32 %8, %2
%10 = select i1 %7, i1 true, i1 %9
%11 = load i32, i32* @FTS_NOINSTR
%12 = icmp eq i32 %11, %2
%13 = select i1 %10, i1 true, i1 %12
%14 = load i32, i32* @FTS_SKIP
%15 = icmp eq i32 %14, %2
%16 = select i1 %13, i1 true, i1 %15
br i1 %16, label %19, label %17
17: ; preds = %3
%18 = load i32, i32* @EINVAL
store i32 %18, i32* @errno
br label %21
19: ; preds = %3
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
store i32 %2, i32* %20
br label %21
21: ; preds = %19, %17
%22 = phi i32 [ 1, %17 ], [ 0, %19 ]
ret i32 %22
}