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

/* Variables and functions */
int /*<<< orphan*/ olist_set_onext(struct olist_head *, struct olist_head *);
int /*<<< orphan*/ olist_set_oprev(struct olist_head *, struct olist_head *);
void __olist_add(struct olist_head *new, struct olist_head *prev,
                 struct olist_head *next) {
  olist_set_oprev(next, new);
  olist_set_onext(new, next);
  olist_set_oprev(new, prev);
  olist_set_onext(prev, new);
}


x86 assembly (clang, -O0):
<__olist_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <olist_set_oprev@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <olist_set_onext@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <olist_set_oprev@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <olist_set_onext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__olist_add>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rdi
mov    %rbx,%rsi
call   1040 <olist_set_oprev@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <olist_set_onext@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <olist_set_oprev@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <olist_set_onext@plt>

LLVM IR (-O0):
%struct.olist_head = type { i32 }
define void @__olist_add(%struct.olist_head* %0, %struct.olist_head* %1, %struct.olist_head* %2) {
%4 = alloca %struct.olist_head*
%5 = alloca %struct.olist_head*
%6 = alloca %struct.olist_head*
store %struct.olist_head* %0, %struct.olist_head** %4
store %struct.olist_head* %1, %struct.olist_head** %5
store %struct.olist_head* %2, %struct.olist_head** %6
%7 = load %struct.olist_head*, %struct.olist_head** %6
%8 = load %struct.olist_head*, %struct.olist_head** %4
%9 = call i32 @olist_set_oprev(%struct.olist_head* %7, %struct.olist_head* %8)
%10 = load %struct.olist_head*, %struct.olist_head** %4
%11 = load %struct.olist_head*, %struct.olist_head** %6
%12 = call i32 @olist_set_onext(%struct.olist_head* %10, %struct.olist_head* %11)
%13 = load %struct.olist_head*, %struct.olist_head** %4
%14 = load %struct.olist_head*, %struct.olist_head** %5
%15 = call i32 @olist_set_oprev(%struct.olist_head* %13, %struct.olist_head* %14)
%16 = load %struct.olist_head*, %struct.olist_head** %5
%17 = load %struct.olist_head*, %struct.olist_head** %4
%18 = call i32 @olist_set_onext(%struct.olist_head* %16, %struct.olist_head* %17)
ret void
}

LLVM IR (-O2):
%struct.olist_head = type { i32 }
define void @__olist_add(%struct.olist_head* %0, %struct.olist_head* %1, %struct.olist_head* %2) {
%4 = tail call i32 @olist_set_oprev(%struct.olist_head* %2, %struct.olist_head* %0)
%5 = tail call i32 @olist_set_onext(%struct.olist_head* %0, %struct.olist_head* %2)
%6 = tail call i32 @olist_set_oprev(%struct.olist_head* %0, %struct.olist_head* %1)
%7 = tail call i32 @olist_set_onext(%struct.olist_head* %1, %struct.olist_head* %0)
ret void
}