#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 iax_session {
  int dummy;
};

/* Variables and functions */
int __send_command(struct iax_session *, char, int, unsigned int,
                   unsigned char *, int, int, int /*<<< orphan*/,
                   int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ destroy_session(struct iax_session *);
int send_command_final(struct iax_session *i, char type, int command,
                       unsigned int ts, unsigned char *data, int datalen,
                       int seqno) {
  int r;
  r = __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1, 0);
  if (r >= 0)
    destroy_session(i);
  return r;
}


x86 assembly (clang, -O0):
<send_command_final>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %sil,%al
mov    0x10(%rbp),%esi
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%sil
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
xor    %r10d,%r10d
movsbl %sil,%esi
mov    %eax,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x1,0x18(%rsp)
movl   $0x0,0x20(%rsp)
call   1030 <__send_command@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     11a1 <send_command_final+0x81>
mov    -0x8(%rbp),%rdi
call   1040 <destroy_session@plt>
mov    -0x28(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_command_final>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x20(%rsp),%eax
sub    $0x8,%rsp
push   $0x0
push   $0x1
push   $0x0
push   $0x0
push   %rax
call   1030 <__send_command@plt>
add    $0x30,%rsp
mov    %eax,%ebp
test   %eax,%eax
js     114e <send_command_final+0x2e>
mov    %rbx,%rdi
call   1040 <destroy_session@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.iax_session = type { i32 }
define i32 @send_command_final(%struct.iax_session* %0, i8 signext %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6) {
%8 = alloca %struct.iax_session*
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.iax_session* %0, %struct.iax_session** %8
store i8 %1, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load %struct.iax_session*, %struct.iax_session** %8
%17 = load i8, i8* %9
%18 = load i32, i32* %10
%19 = load i32, i32* %11
%20 = load i8*, i8** %12
%21 = load i32, i32* %13
%22 = load i32, i32* %14
%23 = call i32 @__send_command(%struct.iax_session* %16, i8 signext %17, i32 %18, i32 %19, i8* %20, i32 %21, i32 %22, i32 0, i32 0, i32 1, i32 0)
store i32 %23, i32* %15
%24 = load i32, i32* %15
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %7
%27 = load %struct.iax_session*, %struct.iax_session** %8
%28 = call i32 @destroy_session(%struct.iax_session* %27)
br label %29
29: ; preds = %26, %7
%30 = load i32, i32* %15
ret i32 %30
}

LLVM IR (-O2):
%struct.iax_session = type { i32 }
define i32 @send_command_final(%struct.iax_session* %0, i8 signext %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6) {
%8 = tail call i32 @__send_command(%struct.iax_session* %0, i8 signext %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6, i32 0, i32 0, i32 1, i32 0)
%9 = icmp sgt i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @destroy_session(%struct.iax_session* %0)
br label %12
12: ; preds = %10, %7
ret i32 %8
}