#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 */

/* Variables and functions */
int /*<<< orphan*/ vis5d_get_slice_link(int, int, int, int **, int **, int **);
int follow_slice_link(int *p_vindex, int *p_type, int *p_num) {
  int *p_next_type, *p_next_num, *p_next_vindex;
  if (!vis5d_get_slice_link(*p_vindex, *p_type, *p_num, &p_next_vindex,
                            &p_next_type, &p_next_num) != 0) {
    return 0;
  }
  *p_type = *p_next_type;
  *p_num = *p_next_num;
  *p_vindex = *p_next_vindex;
  return 1;
}


x86 assembly (clang, -O0):
<follow_slice_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    -0x38(%rbp),%rcx
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
call   1030 <vis5d_get_slice_link@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
je     1169 <follow_slice_link+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1194 <follow_slice_link+0x84>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<follow_slice_link>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%edi
mov    (%rsi),%esi
mov    (%rdx),%edx
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
call   1030 <vis5d_get_slice_link@plt>
test   %eax,%eax
je     1164 <follow_slice_link+0x54>
mov    0x18(%rsp),%rax
mov    (%rax),%eax
mov    %eax,(%rbx)
mov    0x10(%rsp),%rax
mov    (%rax),%eax
mov    %eax,(%r15)
mov    0x8(%rsp),%rax
mov    (%rax),%eax
mov    %eax,(%r14)
mov    $0x1,%eax
jmp    1166 <follow_slice_link+0x56>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @follow_slice_link(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
%17 = call i32 @vis5d_get_slice_link(i32 %12, i32 %14, i32 %16, i32** %10, i32** %8, i32** %9)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %3
store i32 0, i32* %4
br label %33
23: ; preds = %3
%24 = load i32*, i32** %8
%25 = load i32, i32* %24
%26 = load i32*, i32** %6
store i32 %25, i32* %26
%27 = load i32*, i32** %9
%28 = load i32, i32* %27
%29 = load i32*, i32** %7
store i32 %28, i32* %29
%30 = load i32*, i32** %10
%31 = load i32, i32* %30
%32 = load i32*, i32** %5
store i32 %31, i32* %32
store i32 1, i32* %4
br label %33
33: ; preds = %23, %22
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @follow_slice_link(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = bitcast i32** %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = bitcast i32** %6 to i8*
%10 = load i32, i32* %0
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @vis5d_get_slice_link(i32 %10, i32 %11, i32 %12, i32** %6, i32** %4, i32** %5)
%14 = icmp eq i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %3
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
store i32 %17, i32* %1
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
store i32 %19, i32* %2
%20 = load i32*, i32** %6
%21 = load i32, i32* %20
store i32 %21, i32* %0
br label %22
22: ; preds = %3, %15
%23 = phi i32 [ 1, %15 ], [ 0, %3 ]
ret i32 %23
}