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

/* Variables and functions */
int __usb_close(struct usb_dev_handle *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int usb_close(struct usb_dev_handle *dev) {
  int ret;
  fprintf(stderr, "USBSNF: usb_close()\n");
  fprintf(stderr, "USBSNF:   handle       = %p\n", dev);
  ret = __usb_close(dev);
  fprintf(stderr, "USBSNF:   return       = %d\n", ret);
  return ret;
}


x86 assembly (clang, -O0):
<usb_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__usb_close@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_close>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xecc(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <__usb_close@plt>
mov    %eax,%ebx
mov    (%r14),%edi
lea    0xecb(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.usb_dev_handle = type { i32 }
@stderr = global i32 0
@.str = [21 x i8] c"USBSNF: usb_close()\0A\00"
@.str.1 = [29 x i8] c"USBSNF: handle = %p\0A\00"
@.str.2 = [29 x i8] c"USBSNF: return = %d\0A\00"
define i32 @usb_close(%struct.usb_dev_handle* %0) {
%2 = alloca %struct.usb_dev_handle*
%3 = alloca i32
store %struct.usb_dev_handle* %0, %struct.usb_dev_handle** %2
%4 = load i32, i32* @stderr
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = load %struct.usb_dev_handle*, %struct.usb_dev_handle** %2
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %struct.usb_dev_handle* %7)
%9 = load %struct.usb_dev_handle*, %struct.usb_dev_handle** %2
%10 = call i32 @__usb_close(%struct.usb_dev_handle* %9)
store i32 %10, i32* %3
%11 = load i32, i32* @stderr
%12 = load i32, i32* %3
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
%struct.usb_dev_handle = type { i32 }
@stderr = global i32 0
@.str = [21 x i8] c"USBSNF: usb_close()\0A\00"
@.str.1 = [29 x i8] c"USBSNF: handle = %p\0A\00"
@.str.2 = [29 x i8] c"USBSNF: return = %d\0A\00"
define i32 @usb_close(%struct.usb_dev_handle* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %struct.usb_dev_handle* %0)
%6 = tail call i32 @__usb_close(%struct.usb_dev_handle* %0)
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 %6
}