#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inband_close(int);
int inband_open(char *, char *, int, int);
int /*<<< orphan*/ printf(char *);
int notif_host(void) {
  int i, ret, fd;
  int chan;
  unsigned int seq = 0;
  char *data;
  char *buf_p, rx_cmd_type;
  int count;
  struct stat ffstat;
  int flen = 0, len;
  chan = inband_open(("br-lan0"), "00e04c8196c1", 0x9001, 1);
  if (chan < 0) {
    printf("open inband failed!\n");
    return -1;
  }
  inband_close(chan);
  return 0;
}


x86 assembly (clang, -O0):
<notif_host>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x9001,%edx
mov    $0x1,%ecx
call   1050 <inband_open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1188 <notif_host+0x58>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <notif_host+0x67>
mov    -0x14(%rbp),%edi
call   1030 <inband_close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<notif_host>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec9(%rip),%rsi
mov    $0x9001,%edx
mov    $0x1,%ecx
call   1050 <inband_open@plt>
test   %eax,%eax
js     115d <notif_host+0x2d>
mov    %eax,%edi
call   1030 <inband_close@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [8 x i8] c"br-lan0\00"
@.str.1 = [13 x i8] c"00e04c8196c1\00"
@.str.2 = [21 x i8] c"open inband failed!\0A\00"
define i32 @notif_host() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i32
%11 = alloca %struct.stat
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %6
store i32 0, i32* %12
%14 = call i32 @inband_open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 36865, i32 1)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %22
19: ; preds = %0
%20 = load i32, i32* %5
%21 = call i32 @inband_close(i32 %20)
store i32 0, i32* %1
br label %22
22: ; preds = %19, %17
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [8 x i8] c"br-lan0\00"
@.str.1 = [13 x i8] c"00e04c8196c1\00"
@str = [20 x i8] c"open inband failed!\00"
define i32 @notif_host() {
%1 = tail call i32 @inband_open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 36865, i32 1)
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @inband_close(i32 %1)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ -1, %3 ], [ 0, %5 ]
ret i32 %8
}