#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 mapToLinear(int, int);
void setAdj(int **adj, int num_genes, int g0, int g1) {
  int index0, index1;
  index0 = mapToLinear(g0, num_genes);
  index1 = mapToLinear(g1, num_genes);
  adj[index0][index1] = 1;
  index0 = mapToLinear(-g1, num_genes);
  index1 = mapToLinear(-g0, num_genes);
  adj[index0][index1] = 1;
  return;
}


x86 assembly (clang, -O0):
<setAdj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mapToLinear@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mapToLinear@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
xor    %edi,%edi
sub    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mapToLinear@plt>
mov    %eax,-0x18(%rbp)
xor    %edi,%edi
sub    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mapToLinear@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setAdj>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebp
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
mov    %edx,%edi
call   1030 <mapToLinear@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    %r15d,%esi
call   1030 <mapToLinear@plt>
movslq %r12d,%rcx
mov    (%r14,%rcx,8),%rcx
cltq
movl   $0x1,(%rcx,%rax,4)
neg    %ebp
mov    %ebp,%edi
mov    %r15d,%esi
call   1030 <mapToLinear@plt>
mov    %eax,%ebp
neg    %ebx
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <mapToLinear@plt>
movslq %ebp,%rcx
mov    (%r14,%rcx,8),%rcx
cltq
movl   $0x1,(%rcx,%rax,4)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @setAdj(i32** %0, i32 %1, i32 %2, i32 %3) {
%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
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = call i32 @mapToLinear(i32 %11, i32 %12)
store i32 %13, i32* %9
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = call i32 @mapToLinear(i32 %14, i32 %15)
store i32 %16, i32* %10
%17 = load i32**, i32*** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32*, i32** %17, i64 %19
%21 = load i32*, i32** %20
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
store i32 1, i32* %24
%25 = load i32, i32* %8
%26 = sub nsw i32 0, %25
%27 = load i32, i32* %6
%28 = call i32 @mapToLinear(i32 %26, i32 %27)
store i32 %28, i32* %9
%29 = load i32, i32* %7
%30 = sub nsw i32 0, %29
%31 = load i32, i32* %6
%32 = call i32 @mapToLinear(i32 %30, i32 %31)
store i32 %32, i32* %10
%33 = load i32**, i32*** %5
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32*, i32** %33, i64 %35
%37 = load i32*, i32** %36
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 1, i32* %40
ret void
}

LLVM IR (-O2):
define void @setAdj(i32** nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @mapToLinear(i32 %2, i32 %1)
%6 = tail call i32 @mapToLinear(i32 %3, i32 %1)
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = load i32*, i32** %8
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds i32, i32* %9, i64 %10
store i32 1, i32* %11
%12 = sub nsw i32 0, %3
%13 = tail call i32 @mapToLinear(i32 %12, i32 %1)
%14 = sub nsw i32 0, %2
%15 = tail call i32 @mapToLinear(i32 %14, i32 %1)
%16 = sext i32 %13 to i64
%17 = getelementptr inbounds i32*, i32** %0, i64 %16
%18 = load i32*, i32** %17
%19 = sext i32 %15 to i64
%20 = getelementptr inbounds i32, i32* %18, i64 %19
store i32 1, i32* %20
ret void
}