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

/* Variables and functions */
int /*<<< orphan*/ v4l_buffer_init(struct v4l_buffer *, int /*<<< orphan*/,
                                   int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ v4l_queue_buffer_update(struct v4l_queue const *,
                                           struct v4l_buffer *, unsigned int);
int /*<<< orphan*/ v4l_queue_g_memory(struct v4l_queue const *);
int /*<<< orphan*/ v4l_queue_g_type(struct v4l_queue const *);
void v4l_queue_buffer_init(const struct v4l_queue *q, struct v4l_buffer *buf,
                           unsigned index) {
  v4l_buffer_init(buf, v4l_queue_g_type(q), v4l_queue_g_memory(q), index);
  v4l_queue_buffer_update(q, buf, index);
}


x86 assembly (clang, -O0):
<v4l_queue_buffer_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <v4l_queue_g_type@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <v4l_queue_g_memory@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
call   1060 <v4l_buffer_init@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <v4l_queue_buffer_update@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_queue_buffer_init>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1040 <v4l_queue_g_type@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1030 <v4l_queue_g_memory@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%edx
mov    %r14d,%ecx
call   1060 <v4l_buffer_init@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <v4l_queue_buffer_update@plt>

LLVM IR (-O0):
%struct.v4l_queue = type { i32 }
%struct.v4l_buffer = type { i32 }
define void @v4l_queue_buffer_init(%struct.v4l_queue* %0, %struct.v4l_buffer* %1, i32 %2) {
%4 = alloca %struct.v4l_queue*
%5 = alloca %struct.v4l_buffer*
%6 = alloca i32
store %struct.v4l_queue* %0, %struct.v4l_queue** %4
store %struct.v4l_buffer* %1, %struct.v4l_buffer** %5
store i32 %2, i32* %6
%7 = load %struct.v4l_buffer*, %struct.v4l_buffer** %5
%8 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%9 = call i32 @v4l_queue_g_type(%struct.v4l_queue* %8)
%10 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%11 = call i32 @v4l_queue_g_memory(%struct.v4l_queue* %10)
%12 = load i32, i32* %6
%13 = call i32 @v4l_buffer_init(%struct.v4l_buffer* %7, i32 %9, i32 %11, i32 %12)
%14 = load %struct.v4l_queue*, %struct.v4l_queue** %4
%15 = load %struct.v4l_buffer*, %struct.v4l_buffer** %5
%16 = load i32, i32* %6
%17 = call i32 @v4l_queue_buffer_update(%struct.v4l_queue* %14, %struct.v4l_buffer* %15, i32 %16)
ret void
}

LLVM IR (-O2):
%struct.v4l_queue = type { i32 }
%struct.v4l_buffer = type { i32 }
define void @v4l_queue_buffer_init(%struct.v4l_queue* %0, %struct.v4l_buffer* %1, i32 %2) {
%4 = tail call i32 @v4l_queue_g_type(%struct.v4l_queue* %0)
%5 = tail call i32 @v4l_queue_g_memory(%struct.v4l_queue* %0)
%6 = tail call i32 @v4l_buffer_init(%struct.v4l_buffer* %1, i32 %4, i32 %5, i32 %2)
%7 = tail call i32 @v4l_queue_buffer_update(%struct.v4l_queue* %0, %struct.v4l_buffer* %1, i32 %2)
ret void
}