#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 */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, int);
void my_assert_fail(char *, char *, int);
void make_nonblocking(int fd) {
  int flags;
  int err;
  flags = fcntl(fd, F_GETFL, 0);
  ((flags >= 0)
       ? ((void)0)
       : my_assert_fail("flags >= 0",
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/ibaned/"
                        "tetknife/refs/heads/master/ext/relay_posix.c",
                        12));
  flags |= O_NONBLOCK;
  err = fcntl(fd, F_SETFL, flags);
  ((!err) ? ((void)0)
          : my_assert_fail("!err",
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/ibaned/"
                           "tetknife/refs/heads/master/ext/relay_posix.c",
                           15));
}


x86 assembly (clang, -O0):
<make_nonblocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1150 <make_nonblocking+0x30>
jmp    1168 <make_nonblocking+0x48>
lea    0xea9(%rip),%rdi
lea    0xead(%rip),%rsi
mov    $0xc,%edx
call   1040 <my_assert_fail@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    119d <make_nonblocking+0x7d>
jmp    11b5 <make_nonblocking+0x95>
lea    0xef5(%rip),%rdi
lea    0xe60(%rip),%rsi
mov    $0xf,%edx
call   1040 <my_assert_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_nonblocking>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1153 <make_nonblocking+0x33>
lea    0xebe(%rip),%rdi
lea    0xec2(%rip),%rsi
mov    $0xc,%edx
call   1040 <my_assert_fail@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
or     %ebp,%edx
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <fcntl@plt>
test   %eax,%eax
je     1190 <make_nonblocking+0x70>
lea    0xf20(%rip),%rdi
lea    0xe8b(%rip),%rsi
mov    $0xf,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <my_assert_fail@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@F_GETFL = global i32 0
@.str = [11 x i8] c"flags >= 0\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ibaned/tetknife/refs/heads/master/ext/relay_posix.c\00"
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.2 = [5 x i8] c"!err\00"
define void @make_nonblocking(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @F_GETFL
%7 = call i32 @fcntl(i32 %5, i32 %6, i32 0)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* @O_NONBLOCK
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = load i32, i32* @F_SETFL
%18 = load i32, i32* %3
%19 = call i32 @fcntl(i32 %16, i32 %17, i32 %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %12
br label %24
23: ; preds = %12
br label %24
24: ; preds = %23, %22
ret void
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@.str = [11 x i8] c"flags >= 0\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ibaned/tetknife/refs/heads/master/ext/relay_posix.c\00"
@O_NONBLOCK = global i32 0
@F_SETFL = global i32 0
@.str.2 = [5 x i8] c"!err\00"
define void @make_nonblocking(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %6, label %5
5: ; preds = %1
tail call void @my_assert_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 12)
br label %6
6: ; preds = %1, %5
%7 = load i32, i32* @O_NONBLOCK
%8 = or i32 %7, %3
%9 = load i32, i32* @F_SETFL
%10 = tail call i32 @fcntl(i32 %0, i32 %9, i32 %8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %6
tail call void @my_assert_fail(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 15)
br label %13
13: ; preds = %6, %12
ret void
}