#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__ ENODEV;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ O_NONBLOCK;
int /*<<< orphan*/ dropbear_exit(char *);
scalar_t__ errno;
scalar_t__ fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
void setnonblocking(int fd) {
  if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
    if (errno == ENODEV) {
    } else {
      dropbear_exit("Couldn't set nonblocking");
    }
  }
}


x86 assembly (clang, -O0):
<setnonblocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
call   1030 <fcntl@plt>
cmp    $0x0,%rax
jge    117f <setnonblocking+0x5f>
mov    0x2e7a(%rip),%rax
mov    (%rax),%rax
mov    0x2e68(%rip),%rcx
cmp    (%rcx),%rax
jne    116e <setnonblocking+0x4e>
jmp    117a <setnonblocking+0x5a>
lea    0xe8b(%rip),%rdi
call   1040 <dropbear_exit@plt>
jmp    117f <setnonblocking+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setnonblocking>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
call   1030 <fcntl@plt>
test   %rax,%rax
jns    1153 <setnonblocking+0x33>
mov    0x2e8c(%rip),%rax
mov    (%rax),%rax
mov    0x2e7a(%rip),%rcx
cmp    (%rcx),%rax
jne    1155 <setnonblocking+0x35>
pop    %rax
ret
lea    0xea4(%rip),%rdi
pop    %rax
jmp    1040 <dropbear_exit@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@errno = global i64 0
@ENODEV = global i64 0
@.str = [25 x i8] c"Couldn't set nonblocking\00"
define void @setnonblocking(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* @O_NONBLOCK
%6 = call i64 @fcntl(i32 %3, i32 %4, i32 %5)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %1
%9 = load i64, i64* @errno
%10 = load i64, i64* @ENODEV
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
br label %15
13: ; preds = %8
%14 = call i32 @dropbear_exit(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %12
br label %16
16: ; preds = %15, %1
ret void
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@errno = global i64 0
@ENODEV = global i64 0
@.str = [25 x i8] c"Couldn't set nonblocking\00"
define void @setnonblocking(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @O_NONBLOCK
%4 = tail call i64 @fcntl(i32 %0, i32 %2, i32 %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i64, i64* @errno
%8 = load i64, i64* @ENODEV
%9 = icmp eq i64 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @dropbear_exit(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %6, %1
ret void
}