#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 /*<<< orphan*/ errno;
int fts_set(FTS *sp, FTSENT *p, int instr) {
  if (instr && instr != 1 && instr != 2 && instr != 3 && instr != 4) {
    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     115f <fts_set+0x5f>
cmpl   $0x1,-0x1c(%rbp)
je     115f <fts_set+0x5f>
cmpl   $0x2,-0x1c(%rbp)
je     115f <fts_set+0x5f>
cmpl   $0x3,-0x1c(%rbp)
je     115f <fts_set+0x5f>
cmpl   $0x4,-0x1c(%rbp)
je     115f <fts_set+0x5f>
mov    0x2e90(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8f(%rip),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    116f <fts_set+0x6f>
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>:
cmp    $0x5,%edx
jb     111d <fts_set+0x1d>
mov    0x2ecc(%rip),%rax
mov    (%rax),%eax
mov    0x2ecb(%rip),%rcx
mov    %eax,(%rcx)
mov    $0x1,%eax
ret
mov    %edx,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@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 %24
10: ; preds = %3
%11 = load i32, i32* %7
%12 = icmp ne i32 %11, 1
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 4
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = load i32, i32* @EINVAL
store i32 %23, i32* @errno
store i32 1, i32* %4
br label %28
24: ; preds = %19, %16, %13, %10, %3
%25 = load i32, i32* %7
%26 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%27 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %26, i32 0, i32 0
store i32 %25, i32* %27
store i32 0, i32* %4
br label %28
28: ; preds = %24, %22
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@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 ugt i32 %2, 4
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = load i32, i32* @EINVAL
store i32 %6, i32* @errno
br label %9
7: ; preds = %3
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
store i32 %2, i32* %8
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %10
}