#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 AI_FindLinkType(int, int);
int /*<<< orphan*/ AI_LinkString(int);
scalar_t__ AI_PlinkExists(int, int);
int AI_PlinkMoveType(int, int);
int /*<<< orphan*/ Com_Printf(char *, int, int, int /*<<< orphan*/);
void AI_UpdateNodeEdge(int from, int to) {
  int link;
  if (from == -1 || to == -1 || from == to)
    return;
  if (AI_PlinkExists(from, to)) {
    link = AI_PlinkMoveType(from, to);
    Com_Printf("= Link: %i -> %i. %s\n", from, to, AI_LinkString(link));
  } else {
    link = AI_FindLinkType(from, to);
    Com_Printf("^2+^7 Link: %i -> %i. %s\n", from, to, AI_LinkString(link));
  }
}


x86 assembly (clang, -O0):
<AI_UpdateNodeEdge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     117e <AI_UpdateNodeEdge+0x2e>
cmpl   $0xffffffff,-0x8(%rbp)
je     117e <AI_UpdateNodeEdge+0x2e>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1183 <AI_UpdateNodeEdge+0x33>
jmp    1209 <AI_UpdateNodeEdge+0xb9>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <AI_PlinkExists@plt>
cmp    $0x0,%rax
je     11d3 <AI_UpdateNodeEdge+0x83>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <AI_PlinkMoveType@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <AI_LinkString@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xe37(%rip),%rdi
call   1070 <Com_Printf@plt>
jmp    1209 <AI_UpdateNodeEdge+0xb9>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <AI_FindLinkType@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <AI_LinkString@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
lea    0xe12(%rip),%rdi
call   1070 <Com_Printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AI_UpdateNodeEdge>:
push   %rbp
push   %r14
push   %rbx
cmp    %esi,%edi
je     1186 <AI_UpdateNodeEdge+0x36>
mov    %edi,%ebp
cmp    $0xffffffff,%edi
je     1186 <AI_UpdateNodeEdge+0x36>
mov    %esi,%ebx
cmp    $0xffffffff,%esi
je     1186 <AI_UpdateNodeEdge+0x36>
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <AI_PlinkExists@plt>
mov    %ebp,%edi
mov    %ebx,%esi
test   %rax,%rax
je     118b <AI_UpdateNodeEdge+0x3b>
call   1060 <AI_PlinkMoveType@plt>
lea    0xe7c(%rip),%r14
jmp    1197 <AI_UpdateNodeEdge+0x47>
pop    %rbx
pop    %r14
pop    %rbp
ret
call   1030 <AI_FindLinkType@plt>
lea    0xe7f(%rip),%r14
mov    %eax,%edi
call   1050 <AI_LinkString@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <Com_Printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"= Link: %i -> %i. %s\0A\00"
@.str.1 = [26 x i8] c"^2+^7 Link: %i -> %i. %s\0A\00"
define void @AI_UpdateNodeEdge(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11, %8, %2
br label %39
16: ; preds = %11
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i64 @AI_PlinkExists(i32 %17, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @AI_PlinkMoveType(i32 %22, i32 %23)
store i32 %24, i32* %5
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 @AI_LinkString(i32 %27)
%29 = call i32 @Com_Printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26, i32 %28)
br label %39
30: ; preds = %16
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 @AI_FindLinkType(i32 %31, i32 %32)
store i32 %33, i32* %5
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = call i32 @AI_LinkString(i32 %36)
%38 = call i32 @Com_Printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %37)
br label %39
39: ; preds = %15, %30, %21
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"= Link: %i -> %i. %s\0A\00"
@.str.1 = [26 x i8] c"^2+^7 Link: %i -> %i. %s\0A\00"
define void @AI_UpdateNodeEdge(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, -1
%4 = icmp eq i32 %1, -1
%5 = or i1 %3, %4
%6 = icmp eq i32 %0, %1
%7 = or i1 %6, %5
br i1 %7, label %20, label %8
8: ; preds = %2
%9 = tail call i64 @AI_PlinkExists(i32 %0, i32 %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @AI_PlinkMoveType(i32 %0, i32 %1)
br label %15
13: ; preds = %8
%14 = tail call i32 @AI_FindLinkType(i32 %0, i32 %1)
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %12, %11 ], [ %14, %13 ]
%17 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), %11 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), %13 ]
%18 = tail call i32 @AI_LinkString(i32 %16)
%19 = tail call i32 @Com_Printf(i8* %17, i32 %0, i32 %1, i32 %18)
br label %20
20: ; preds = %15, %2
ret void
}