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

/* Variables and functions */
int /*<<< orphan*/ add_use(int /*<<< orphan*/, int, struct object *);
int /*<<< orphan*/ get_used_dir(int /*<<< orphan*/, struct object *);
int /*<<< orphan*/ insert_into(struct object *, struct object *);
int /*<<< orphan*/ volume_shell(struct object *);
void weld_volume_face_into(struct object *big_volume,
                           struct object *small_volume,
                           struct object *big_volume_face,
                           struct object *small_volume_face) {
  insert_into(big_volume_face, small_volume_face);
  add_use(volume_shell(big_volume),
          !(get_used_dir(volume_shell(small_volume), small_volume_face)),
          small_volume_face);
}


x86 assembly (clang, -O0):
<weld_volume_face_into>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <insert_into@plt>
mov    -0x8(%rbp),%rdi
call   1030 <volume_shell@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <volume_shell@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1050 <get_used_dir@plt>
mov    -0x24(%rbp),%edi
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
mov    -0x20(%rbp),%rdx
call   1060 <add_use@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weld_volume_face_into>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    %rcx,%rsi
call   1040 <insert_into@plt>
mov    %r15,%rdi
call   1030 <volume_shell@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <volume_shell@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <get_used_dir@plt>
xor    %esi,%esi
test   %eax,%eax
sete   %sil
mov    %ebp,%edi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <add_use@plt>

LLVM IR (-O0):
%struct.object = type { i32 }
define void @weld_volume_face_into(%struct.object* %0, %struct.object* %1, %struct.object* %2, %struct.object* %3) {
%5 = alloca %struct.object*
%6 = alloca %struct.object*
%7 = alloca %struct.object*
%8 = alloca %struct.object*
store %struct.object* %0, %struct.object** %5
store %struct.object* %1, %struct.object** %6
store %struct.object* %2, %struct.object** %7
store %struct.object* %3, %struct.object** %8
%9 = load %struct.object*, %struct.object** %7
%10 = load %struct.object*, %struct.object** %8
%11 = call i32 @insert_into(%struct.object* %9, %struct.object* %10)
%12 = load %struct.object*, %struct.object** %5
%13 = call i32 @volume_shell(%struct.object* %12)
%14 = load %struct.object*, %struct.object** %6
%15 = call i32 @volume_shell(%struct.object* %14)
%16 = load %struct.object*, %struct.object** %8
%17 = call i32 @get_used_dir(i32 %15, %struct.object* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = load %struct.object*, %struct.object** %8
%22 = call i32 @add_use(i32 %13, i32 %20, %struct.object* %21)
ret void
}

LLVM IR (-O2):
%struct.object = type { i32 }
define void @weld_volume_face_into(%struct.object* %0, %struct.object* %1, %struct.object* %2, %struct.object* %3) {
%5 = tail call i32 @insert_into(%struct.object* %2, %struct.object* %3)
%6 = tail call i32 @volume_shell(%struct.object* %0)
%7 = tail call i32 @volume_shell(%struct.object* %1)
%8 = tail call i32 @get_used_dir(i32 %7, %struct.object* %3)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @add_use(i32 %6, i32 %10, %struct.object* %3)
ret void
}