#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*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void SetPair(int i, int j, int thepairs[]) {
  if (thepairs[i] != -1 || thepairs[j] != -1) {
    printf("Error in assigning pairs in backtrack %d %d!\n", i, j);
    exit(1);
  }
  thepairs[i] = j;
  thepairs[j] = i;
}


x86 assembly (clang, -O0):
<SetPair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1156 <SetPair+0x36>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1172 <SetPair+0x52>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetPair>:
push   %rax
mov    %esi,%eax
mov    %edi,%esi
movslq %edi,%rcx
cmpl   $0xffffffff,(%rdx,%rcx,4)
jne    113f <SetPair+0x1f>
movslq %eax,%rdi
cmpl   $0xffffffff,(%rdx,%rdi,4)
jne    113f <SetPair+0x1f>
mov    %eax,(%rdx,%rcx,4)
mov    %esi,(%rdx,%rdi,4)
pop    %rax
ret
lea    0xeba(%rip),%rdi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Error in assigning pairs in backtrack %d %d!\0A\00"
define void @SetPair(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
%12 = icmp ne i32 %11, -1
br i1 %12, label %20, label %13
13: ; preds = %3
%14 = load i32*, i32** %6
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %25
20: ; preds = %13, %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %13
%26 = load i32, i32* %5
%27 = load i32*, i32** %6
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %26, i32* %30
%31 = load i32, i32* %4
%32 = load i32*, i32** %6
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
store i32 %31, i32* %35
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Error in assigning pairs in backtrack %d %d!\0A\00"
define void @SetPair(i32 %0, i32 %1, i32* nocapture %2) {
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds i32, i32* %2, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i32, i32* %2, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, -1
br i1 %12, label %16, label %13
13: ; preds = %8, %3
%14 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %8
store i32 %1, i32* %5
store i32 %0, i32* %10
ret void
}