int mtk_nfchod_deinit_sw_queue(int *fd) {
  int ret = 0;
  if (fd != ((void *)0)) {
    if ((*fd) != -1) {
      close((*fd));
      (*fd) = -1;
    }
  } else {
    {
      printf("nfcho(E)");
      printf("fd,NULL");
      printf("\n");
    };
    ret = -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<mtk_nfchod_deinit_sw_queue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1167 <mtk_nfchod_deinit_sw_queue+0x47>
mov    -0x8(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     1162 <mtk_nfchod_deinit_sw_queue+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1040 <close@plt>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
jmp    1198 <mtk_nfchod_deinit_sw_queue+0x78>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtk_nfchod_deinit_sw_queue>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1153 <mtk_nfchod_deinit_sw_queue+0x23>
mov    %rdi,%rbx
mov    (%rdi),%edi
xor    %ebp,%ebp
cmp    $0xffffffff,%edi
je     117e <mtk_nfchod_deinit_sw_queue+0x4e>
xor    %eax,%eax
call   1050 <close@plt>
movl   $0xffffffff,(%rbx)
jmp    117e <mtk_nfchod_deinit_sw_queue+0x4e>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"nfcho(E)\00"
@.str.1 = [8 x i8] c"fd,NULL\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @mtk_nfchod_deinit_sw_queue(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %12)
%14 = load i32*, i32** %2
store i32 -1, i32* %14
br label %15
15: ; preds = %10, %6
br label %20
16: ; preds = %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %20
20: ; preds = %16, %15
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [9 x i8] c"nfcho(E)\00"
@.str.1 = [8 x i8] c"fd,NULL\00"
define i32 @mtk_nfchod_deinit_sw_queue(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = icmp eq i32 %4, -1
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %4)
store i32 -1, i32* %0
br label %12
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @putchar(i32 10)
br label %12
12: ; preds = %3, %6, %8
%13 = phi i32 [ 0, %6 ], [ 0, %3 ], [ -1, %8 ]
ret i32 %13
}