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

/* Variables and functions */
int maxmatch2(struct vtx_data **, int, int *, int);
int maxmatch3(struct vtx_data **, int, int *, int);
int maxmatch4(struct vtx_data **, int, int, int *, int);
int maxmatch9(struct vtx_data **, int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int maxmatch(struct vtx_data **graph, int nvtxs, int nedges, int *mflag,
             int using_ewgts, int igeom, float **coords) {
  extern int DEBUG_COARSEN;
  extern int MATCH_TYPE;
  int nmerged = 0;
  int maxmatch1(), maxmatch2(), maxmatch3(), maxmatch4();
  int maxmatch5(), maxmatch9();
  if (MATCH_TYPE == 1 || (MATCH_TYPE == 5 && coords == NULL)) {
    nmerged = maxmatch1(graph, nvtxs, mflag, using_ewgts);
  } else if (MATCH_TYPE == 2) {
    nmerged = maxmatch2(graph, nvtxs, mflag, using_ewgts);
  } else if (MATCH_TYPE == 3) {
    nmerged = maxmatch3(graph, nvtxs, mflag, using_ewgts);
  } else if (MATCH_TYPE == 4) {
    nmerged = maxmatch4(graph, nvtxs, nedges, mflag, using_ewgts);
  } else if (MATCH_TYPE == 5 && coords != NULL) {
    nmerged = maxmatch5(graph, nvtxs, mflag, igeom, coords);
  } else if (MATCH_TYPE == 9) {
    nmerged = maxmatch9(graph, nvtxs, mflag, using_ewgts);
  }
  if (DEBUG_COARSEN > 0) {
    printf("Number of matching edges = %d\n", nmerged);
  }
  return (nmerged);
}


x86 assembly (clang, -O0):
<maxmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    0x2e58(%rip),%rax
cmpl   $0x1,(%rax)
je     11c4 <maxmatch+0x54>
mov    0x2e48(%rip),%rax
cmpl   $0x5,(%rax)
jne    11e1 <maxmatch+0x71>
cmpq   $0x0,0x10(%rbp)
jne    11e1 <maxmatch+0x71>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x0,%al
call   1060 <maxmatch1@plt>
mov    %eax,-0x24(%rbp)
jmp    12e1 <maxmatch+0x171>
mov    0x2e10(%rip),%rax
cmpl   $0x2,(%rax)
jne    120c <maxmatch+0x9c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1090 <maxmatch2@plt>
mov    %eax,-0x24(%rbp)
jmp    12dc <maxmatch+0x16c>
mov    0x2de5(%rip),%rax
cmpl   $0x3,(%rax)
jne    1237 <maxmatch+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <maxmatch3@plt>
mov    %eax,-0x24(%rbp)
jmp    12d7 <maxmatch+0x167>
mov    0x2dba(%rip),%rax
cmpl   $0x4,(%rax)
jne    1266 <maxmatch+0xf6>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1080 <maxmatch4@plt>
mov    %eax,-0x24(%rbp)
jmp    12d2 <maxmatch+0x162>
mov    0x2d8b(%rip),%rax
cmpl   $0x5,(%rax)
jne    12a2 <maxmatch+0x132>
cmpq   $0x0,0x10(%rbp)
je     12a2 <maxmatch+0x132>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    0x10(%rbp),%r8
mov    $0x0,%al
call   1030 <maxmatch5@plt>
mov    %eax,-0x24(%rbp)
jmp    12cd <maxmatch+0x15d>
mov    0x2d4f(%rip),%rax
cmpl   $0x9,(%rax)
jne    12c8 <maxmatch+0x158>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <maxmatch9@plt>
mov    %eax,-0x24(%rbp)
jmp    12cd <maxmatch+0x15d>
jmp    12d2 <maxmatch+0x162>
jmp    12d7 <maxmatch+0x167>
jmp    12dc <maxmatch+0x16c>
jmp    12e1 <maxmatch+0x171>
mov    0x2cf0(%rip),%rax
cmpl   $0x0,(%rax)
jle    1300 <maxmatch+0x190>
mov    -0x24(%rbp),%esi
lea    0xd05(%rip),%rdi
call   1070 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxmatch>:
push   %rbx
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
cmp    $0x1,%eax
je     118e <maxmatch+0x1e>
mov    0x10(%rsp),%rbx
test   %rbx,%rbx
jne    11bb <maxmatch+0x4b>
cmp    $0x5,%eax
jne    11bb <maxmatch+0x4b>
mov    %rcx,%rdx
mov    %r8d,%ecx
xor    %eax,%eax
call   1060 <maxmatch1@plt>
mov    %eax,%ebx
mov    0x2e34(%rip),%rax
cmpl   $0x0,(%rax)
jle    11b7 <maxmatch+0x47>
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
call   1070 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
cmp    $0x4,%eax
je     11d7 <maxmatch+0x67>
cmp    $0x3,%eax
je     11de <maxmatch+0x6e>
cmp    $0x2,%eax
jne    11eb <maxmatch+0x7b>
mov    %rcx,%rdx
mov    %r8d,%ecx
call   1090 <maxmatch2@plt>
jmp    119b <maxmatch+0x2b>
call   1080 <maxmatch4@plt>
jmp    119b <maxmatch+0x2b>
mov    %rcx,%rdx
mov    %r8d,%ecx
call   1050 <maxmatch3@plt>
jmp    119b <maxmatch+0x2b>
test   %rbx,%rbx
je     1207 <maxmatch+0x97>
cmp    $0x5,%eax
jne    1207 <maxmatch+0x97>
mov    %rcx,%rdx
mov    %r9d,%ecx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <maxmatch5@plt>
jmp    119b <maxmatch+0x2b>
xor    %ebx,%ebx
cmp    $0x9,%eax
jne    119d <maxmatch+0x2d>
mov    %rcx,%rdx
mov    %r8d,%ecx
call   1040 <maxmatch9@plt>
jmp    119b <maxmatch+0x2b>

LLVM IR (-O0):
%struct.vtx_data = type { i32 }
@MATCH_TYPE = external global i32
@DEBUG_COARSEN = external global i32
@.str = [31 x i8] c"Number of matching edges = %d\0A\00"
define i32 @maxmatch(%struct.vtx_data** %0, i32 %1, i32 %2, i32* %3, i32 %4, i32 %5, float** %6) {
%8 = alloca %struct.vtx_data**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca float**
%15 = alloca i32
store %struct.vtx_data** %0, %struct.vtx_data*** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32* %3, i32** %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store float** %6, float*** %14
store i32 0, i32* %15
%16 = load i32, i32* @MATCH_TYPE
%17 = icmp eq i32 %16, 1
br i1 %17, label %24, label %18
18: ; preds = %7
%19 = load i32, i32* @MATCH_TYPE
%20 = icmp eq i32 %19, 5
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load float**, float*** %14
%23 = icmp eq float** %22, null
br i1 %23, label %24, label %30
24: ; preds = %21, %7
%25 = load %struct.vtx_data**, %struct.vtx_data*** %8
%26 = load i32, i32* %9
%27 = load i32*, i32** %11
%28 = load i32, i32* %12
%29 = call i32 (%struct.vtx_data**, i32, i32*, i32, ...) bitcast (i32 (...)* @maxmatch1 to i32 (%struct.vtx_data**, i32, i32*, i32, ...)*)(%struct.vtx_data** %25, i32 %26, i32* %27, i32 %28)
store i32 %29, i32* %15
br label %85
30: ; preds = %21, %18
%31 = load i32, i32* @MATCH_TYPE
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load %struct.vtx_data**, %struct.vtx_data*** %8
%35 = load i32, i32* %9
%36 = load i32*, i32** %11
%37 = load i32, i32* %12
%38 = call i32 @maxmatch2(%struct.vtx_data** %34, i32 %35, i32* %36, i32 %37)
store i32 %38, i32* %15
br label %84
39: ; preds = %30
%40 = load i32, i32* @MATCH_TYPE
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load %struct.vtx_data**, %struct.vtx_data*** %8
%44 = load i32, i32* %9
%45 = load i32*, i32** %11
%46 = load i32, i32* %12
%47 = call i32 @maxmatch3(%struct.vtx_data** %43, i32 %44, i32* %45, i32 %46)
store i32 %47, i32* %15
br label %83
48: ; preds = %39
%49 = load i32, i32* @MATCH_TYPE
%50 = icmp eq i32 %49, 4
br i1 %50, label %51, label %58
51: ; preds = %48
%52 = load %struct.vtx_data**, %struct.vtx_data*** %8
%53 = load i32, i32* %9
%54 = load i32, i32* %10
%55 = load i32*, i32** %11
%56 = load i32, i32* %12
%57 = call i32 @maxmatch4(%struct.vtx_data** %52, i32 %53, i32 %54, i32* %55, i32 %56)
store i32 %57, i32* %15
br label %82
58: ; preds = %48
%59 = load i32, i32* @MATCH_TYPE
%60 = icmp eq i32 %59, 5
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = load float**, float*** %14
%63 = icmp ne float** %62, null
br i1 %63, label %64, label %71
64: ; preds = %61
%65 = load %struct.vtx_data**, %struct.vtx_data*** %8
%66 = load i32, i32* %9
%67 = load i32*, i32** %11
%68 = load i32, i32* %13
%69 = load float**, float*** %14
%70 = call i32 (%struct.vtx_data**, i32, i32*, i32, float**, ...) bitcast (i32 (...)* @maxmatch5 to i32 (%struct.vtx_data**, i32, i32*, i32, float**, ...)*)(%struct.vtx_data** %65, i32 %66, i32* %67, i32 %68, float** %69)
store i32 %70, i32* %15
br label %81
71: ; preds = %61, %58
%72 = load i32, i32* @MATCH_TYPE
%73 = icmp eq i32 %72, 9
br i1 %73, label %74, label %80
74: ; preds = %71
%75 = load %struct.vtx_data**, %struct.vtx_data*** %8
%76 = load i32, i32* %9
%77 = load i32*, i32** %11
%78 = load i32, i32* %12
%79 = call i32 @maxmatch9(%struct.vtx_data** %75, i32 %76, i32* %77, i32 %78)
store i32 %79, i32* %15
br label %80
80: ; preds = %74, %71
br label %81
81: ; preds = %80, %64
br label %82
82: ; preds = %81, %51
br label %83
83: ; preds = %82, %42
br label %84
84: ; preds = %83, %33
br label %85
85: ; preds = %84, %24
%86 = load i32, i32* @DEBUG_COARSEN
%87 = icmp sgt i32 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %85
%89 = load i32, i32* %15
%90 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %89)
br label %91
91: ; preds = %88, %85
%92 = load i32, i32* %15
ret i32 %92
}

LLVM IR (-O2):
%struct.vtx_data = type { i32 }
@MATCH_TYPE = external global i32
@DEBUG_COARSEN = external global i32
@.str = [31 x i8] c"Number of matching edges = %d\0A\00"
define i32 @maxmatch(%struct.vtx_data** %0, i32 %1, i32 %2, i32* %3, i32 %4, i32 %5, float** %6) {
%8 = load i32, i32* @MATCH_TYPE
%9 = icmp eq i32 %8, 1
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = icmp eq i32 %8, 5
%12 = icmp eq float** %6, null
%13 = and i1 %12, %11
br i1 %13, label %14, label %16
14: ; preds = %10, %7
%15 = tail call i32 (%struct.vtx_data**, i32, i32*, i32, ...) bitcast (i32 (...)* @maxmatch1 to i32 (%struct.vtx_data**, i32, i32*, i32, ...)*)(%struct.vtx_data** %0, i32 %1, i32* %3, i32 %4)
br label %32
16: ; preds = %10
switch i32 %8, label %23 [
i32 2, label %17
i32 3, label %19
i32 4, label %21
]
17: ; preds = %16
%18 = tail call i32 @maxmatch2(%struct.vtx_data** %0, i32 %1, i32* %3, i32 %4)
br label %32
19: ; preds = %16
%20 = tail call i32 @maxmatch3(%struct.vtx_data** %0, i32 %1, i32* %3, i32 %4)
br label %32
21: ; preds = %16
%22 = tail call i32 @maxmatch4(%struct.vtx_data** %0, i32 %1, i32 %2, i32* %3, i32 %4)
br label %32
23: ; preds = %16
%24 = icmp ne float** %6, null
%25 = and i1 %24, %11
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 (%struct.vtx_data**, i32, i32*, i32, float**, ...) bitcast (i32 (...)* @maxmatch5 to i32 (%struct.vtx_data**, i32, i32*, i32, float**, ...)*)(%struct.vtx_data** %0, i32 %1, i32* %3, i32 %5, float** %6)
br label %32
28: ; preds = %23
%29 = icmp eq i32 %8, 9
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = tail call i32 @maxmatch9(%struct.vtx_data** %0, i32 %1, i32* %3, i32 %4)
br label %32
32: ; preds = %17, %21, %28, %30, %26, %19, %14
%33 = phi i32 [ %15, %14 ], [ %18, %17 ], [ %20, %19 ], [ %22, %21 ], [ %27, %26 ], [ %31, %30 ], [ 0, %28 ]
%34 = load i32, i32* @DEBUG_COARSEN
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %33)
br label %38
38: ; preds = %36, %32
ret i32 %33
}