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

/* Variables and functions */
scalar_t__ find_index(struct cube *, int, short *, short *, short *, short *);
void *remove_z_node(struct cube *, short, short, short, short);
void *del_index(struct cube *cube, int index) {
  short w, x, y, z;
  if (find_index(cube, index, &w, &x, &y, &z)) {
    return remove_z_node(cube, w, x, y, z);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<del_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x16(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1a(%rbp),%r8
lea    -0x1c(%rbp),%r9
call   1040 <find_index@plt>
cmp    $0x0,%rax
je     1181 <del_index+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x16(%rbp),%dx
mov    -0x18(%rbp),%cx
mov    -0x1a(%rbp),%ax
movswl %dx,%esi
movswl %cx,%edx
movswl %ax,%ecx
movswl -0x1c(%rbp),%r8d
call   1030 <remove_z_node@plt>
mov    %rax,-0x8(%rbp)
jmp    1189 <del_index+0x69>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_index>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xe(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0xa(%rsp),%r8
lea    0x8(%rsp),%r9
call   1040 <find_index@plt>
test   %rax,%rax
je     1165 <del_index+0x45>
movswl 0xe(%rsp),%esi
movswl 0xc(%rsp),%edx
movswl 0xa(%rsp),%ecx
movswl 0x8(%rsp),%r8d
mov    %rbx,%rdi
call   1030 <remove_z_node@plt>
jmp    1167 <del_index+0x47>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.cube = type { i32 }
define i8* @del_index(%struct.cube* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca %struct.cube*
%5 = alloca i32
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
store %struct.cube* %0, %struct.cube** %4
store i32 %1, i32* %5
%10 = load %struct.cube*, %struct.cube** %4
%11 = load i32, i32* %5
%12 = call i64 @find_index(%struct.cube* %10, i32 %11, i16* %6, i16* %7, i16* %8, i16* %9)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load %struct.cube*, %struct.cube** %4
%16 = load i16, i16* %6
%17 = load i16, i16* %7
%18 = load i16, i16* %8
%19 = load i16, i16* %9
%20 = call i8* @remove_z_node(%struct.cube* %15, i16 signext %16, i16 signext %17, i16 signext %18, i16 signext %19)
store i8* %20, i8** %3
br label %22
21: ; preds = %2
store i8* null, i8** %3
br label %22
22: ; preds = %21, %14
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
%struct.cube = type { i32 }
define i8* @del_index(%struct.cube* %0, i32 %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = bitcast i16* %3 to i8*
%8 = bitcast i16* %4 to i8*
%9 = bitcast i16* %5 to i8*
%10 = bitcast i16* %6 to i8*
%11 = call i64 @find_index(%struct.cube* %0, i32 %1, i16* %3, i16* %4, i16* %5, i16* %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %2
%14 = load i16, i16* %3
%15 = load i16, i16* %4
%16 = load i16, i16* %5
%17 = load i16, i16* %6
%18 = call i8* @remove_z_node(%struct.cube* %0, i16 signext %14, i16 signext %15, i16 signext %16, i16 signext %17)
br label %19
19: ; preds = %2, %13
%20 = phi i8* [ %18, %13 ], [ null, %2 ]
ret i8* %20
}