#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 v4l_queue {
  int dummy;
};
struct v4l_fd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ v4l_queue_close_exported_fds(struct v4l_queue *);
int /*<<< orphan*/ v4l_queue_free_bufs(struct v4l_queue *);
int /*<<< orphan*/ v4l_queue_munmap_bufs(struct v4l_fd *, struct v4l_queue *);
int /*<<< orphan*/ v4l_queue_reqbufs(struct v4l_fd *, struct v4l_queue *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ v4l_queue_streamoff(struct v4l_fd *, struct v4l_queue *);
void v4l_queue_free(struct v4l_fd *f, struct v4l_queue *q) {
  v4l_queue_streamoff(f, q);
  v4l_queue_free_bufs(q);
  v4l_queue_munmap_bufs(f, q);
  v4l_queue_close_exported_fds(q);
  v4l_queue_reqbufs(f, q, 0);
}


x86 assembly (clang, -O0):
<v4l_queue_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <v4l_queue_streamoff@plt>
mov    -0x10(%rbp),%rdi
call   1030 <v4l_queue_free_bufs@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <v4l_queue_munmap_bufs@plt>
mov    -0x10(%rbp),%rdi
call   1060 <v4l_queue_close_exported_fds@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <v4l_queue_reqbufs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_queue_free>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1050 <v4l_queue_streamoff@plt>
mov    %rbx,%rdi
call   1030 <v4l_queue_free_bufs@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <v4l_queue_munmap_bufs@plt>
mov    %rbx,%rdi
call   1060 <v4l_queue_close_exported_fds@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <v4l_queue_reqbufs@plt>

LLVM IR (-O0):
%struct.v4l_fd = type { i32 }
%struct.v4l_queue = type { i32 }
define void @v4l_queue_free(%struct.v4l_fd* %0, %struct.v4l_queue* %1) {
%3 = alloca %struct.v4l_fd*
%4 = alloca %struct.v4l_queue*
store %struct.v4l_fd* %0, %struct.v4l_fd** %3
store %struct.v4l_queue* %1, %struct.v4l_queue** %4
%5 = load %struct.v4l_fd*, %struct.v4l_fd** %3
%6 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%7 = call i32 @v4l_queue_streamoff(%struct.v4l_fd* %5, %struct.v4l_queue* %6)
%8 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%9 = call i32 @v4l_queue_free_bufs(%struct.v4l_queue* %8)
%10 = load %struct.v4l_fd*, %struct.v4l_fd** %3
%11 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%12 = call i32 @v4l_queue_munmap_bufs(%struct.v4l_fd* %10, %struct.v4l_queue* %11)
%13 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%14 = call i32 @v4l_queue_close_exported_fds(%struct.v4l_queue* %13)
%15 = load %struct.v4l_fd*, %struct.v4l_fd** %3
%16 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%17 = call i32 @v4l_queue_reqbufs(%struct.v4l_fd* %15, %struct.v4l_queue* %16, i32 0)
ret void
}

LLVM IR (-O2):
%struct.v4l_fd = type { i32 }
%struct.v4l_queue = type { i32 }
define void @v4l_queue_free(%struct.v4l_fd* %0, %struct.v4l_queue* %1) {
%3 = tail call i32 @v4l_queue_streamoff(%struct.v4l_fd* %0, %struct.v4l_queue* %1)
%4 = tail call i32 @v4l_queue_free_bufs(%struct.v4l_queue* %1)
%5 = tail call i32 @v4l_queue_munmap_bufs(%struct.v4l_fd* %0, %struct.v4l_queue* %1)
%6 = tail call i32 @v4l_queue_close_exported_fds(%struct.v4l_queue* %1)
%7 = tail call i32 @v4l_queue_reqbufs(%struct.v4l_fd* %0, %struct.v4l_queue* %1, i32 0)
ret void
}