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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int mget(struct graph *, int, int);
int /*<<< orphan*/ nei_add(struct graph *, int, int);
void add_edge(struct graph *g, int a, int b) {
  assert(a != b && mget(g, a, b) < 3);
  nei_add(g, a, b);
  nei_add(g, b, a);
}


x86 assembly (clang, -O0):
<add_edge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x11(%rbp)
je     116b <add_edge+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <mget@plt>
cmp    $0x3,%eax
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <nei_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <nei_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_edge>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
xor    %edi,%edi
cmp    %edx,%esi
je     1156 <add_edge+0x26>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <mget@plt>
xor    %edi,%edi
cmp    $0x3,%eax
setl   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <nei_add@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <nei_add@plt>

LLVM IR (-O0):
%struct.graph = type { i32 }
define void @add_edge(%struct.graph* %0, i32 %1, i32 %2) {
%4 = alloca %struct.graph*
%5 = alloca i32
%6 = alloca i32
store %struct.graph* %0, %struct.graph** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load %struct.graph*, %struct.graph** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @mget(%struct.graph* %11, i32 %12, i32 %13)
%15 = icmp slt i32 %14, 3
br label %16
16: ; preds = %10, %3
%17 = phi i1 [ false, %3 ], [ %15, %10 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.graph*, %struct.graph** %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @nei_add(%struct.graph* %20, i32 %21, i32 %22)
%24 = load %struct.graph*, %struct.graph** %4
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = call i32 @nei_add(%struct.graph* %24, i32 %25, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.graph = type { i32 }
define void @add_edge(%struct.graph* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = tail call i32 @mget(%struct.graph* %0, i32 %1, i32 %2)
%7 = icmp slt i32 %6, 3
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ 0, %3 ], [ %8, %5 ]
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32 @nei_add(%struct.graph* %0, i32 %1, i32 %2)
%13 = tail call i32 @nei_add(%struct.graph* %0, i32 %2, i32 %1)
ret void
}