#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 */
scalar_t__ canFinish(int, int **, int, int *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int i, course_num = 6, pair_num = 6;
  int **pairs = malloc(pair_num * sizeof(int *));
  int *col_sizes = malloc(pair_num * sizeof(int));
  pairs[0] = malloc(2 * sizeof(int));
  pairs[0][0] = 1;
  pairs[0][1] = 0;
  col_sizes[0] = 2;
  pairs[1] = malloc(2 * sizeof(int));
  pairs[1][0] = 2;
  pairs[1][1] = 1;
  col_sizes[1] = 2;
  pairs[2] = malloc(2 * sizeof(int));
  pairs[2][0] = 3;
  pairs[2][1] = 2;
  col_sizes[2] = 2;
  pairs[3] = malloc(2 * sizeof(int));
  pairs[3][0] = 1;
  pairs[3][1] = 3;
  col_sizes[3] = 2;
  pairs[4] = malloc(2 * sizeof(int));
  pairs[4][0] = 4;
  pairs[4][1] = 0;
  col_sizes[4] = 2;
  pairs[5] = malloc(2 * sizeof(int));
  pairs[5][0] = 0;
  pairs[5][1] = 5;
  col_sizes[5] = 2;
  printf("%s\n",
         canFinish(course_num, pairs, pair_num, col_sizes) ? "true" : "false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0xc(%rbp)
movl   $0x6,-0x10(%rbp)
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x2,(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x1,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0x4(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x3,(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x2,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0x8(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0xc(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x4,(%rax)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0x10(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rax
movl   $0x5,0x4(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2,0x14(%rax)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <canFinish@plt>
mov    %rax,%rcx
lea    0xd0f(%rip),%rsi
lea    0xd03(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xcf0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x30,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx)
movq   $0x1,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rbx)
movabs $0x100000002,%rcx
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x10(%rbx)
movabs $0x200000003,%rcx
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x18(%rbx)
movabs $0x300000001,%rcx
mov    %rcx,(%rax)
movaps 0xe46(%rip),%xmm0
movups %xmm0,(%r14)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x20(%rbx)
movq   $0x4,(%rax)
movl   $0x2,0x10(%r14)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x28(%rbx)
movabs $0x500000000,%rcx
mov    %rcx,(%rax)
movl   $0x2,0x14(%r14)
mov    $0x6,%edi
mov    %rbx,%rsi
mov    $0x6,%edx
mov    %r14,%rcx
call   1040 <canFinish@plt>
test   %rax,%rax
lea    0xdfc(%rip),%rax
lea    0xdf0(%rip),%rsi
cmove  %rax,%rsi
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32*
store i32 0, i32* %1
store i32 6, i32* %3
store i32 6, i32* %4
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 8
%10 = trunc i64 %9 to i32
%11 = call i8* @malloc(i32 %10)
%12 = bitcast i8* %11 to i32**
store i32** %12, i32*** %5
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = trunc i64 %15 to i32
%17 = call i8* @malloc(i32 %16)
%18 = bitcast i8* %17 to i32*
store i32* %18, i32** %6
%19 = call i8* @malloc(i32 8)
%20 = bitcast i8* %19 to i32*
%21 = load i32**, i32*** %5
%22 = getelementptr inbounds i32*, i32** %21, i64 0
store i32* %20, i32** %22
%23 = load i32**, i32*** %5
%24 = getelementptr inbounds i32*, i32** %23, i64 0
%25 = load i32*, i32** %24
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 1, i32* %26
%27 = load i32**, i32*** %5
%28 = getelementptr inbounds i32*, i32** %27, i64 0
%29 = load i32*, i32** %28
%30 = getelementptr inbounds i32, i32* %29, i64 1
store i32 0, i32* %30
%31 = load i32*, i32** %6
%32 = getelementptr inbounds i32, i32* %31, i64 0
store i32 2, i32* %32
%33 = call i8* @malloc(i32 8)
%34 = bitcast i8* %33 to i32*
%35 = load i32**, i32*** %5
%36 = getelementptr inbounds i32*, i32** %35, i64 1
store i32* %34, i32** %36
%37 = load i32**, i32*** %5
%38 = getelementptr inbounds i32*, i32** %37, i64 1
%39 = load i32*, i32** %38
%40 = getelementptr inbounds i32, i32* %39, i64 0
store i32 2, i32* %40
%41 = load i32**, i32*** %5
%42 = getelementptr inbounds i32*, i32** %41, i64 1
%43 = load i32*, i32** %42
%44 = getelementptr inbounds i32, i32* %43, i64 1
store i32 1, i32* %44
%45 = load i32*, i32** %6
%46 = getelementptr inbounds i32, i32* %45, i64 1
store i32 2, i32* %46
%47 = call i8* @malloc(i32 8)
%48 = bitcast i8* %47 to i32*
%49 = load i32**, i32*** %5
%50 = getelementptr inbounds i32*, i32** %49, i64 2
store i32* %48, i32** %50
%51 = load i32**, i32*** %5
%52 = getelementptr inbounds i32*, i32** %51, i64 2
%53 = load i32*, i32** %52
%54 = getelementptr inbounds i32, i32* %53, i64 0
store i32 3, i32* %54
%55 = load i32**, i32*** %5
%56 = getelementptr inbounds i32*, i32** %55, i64 2
%57 = load i32*, i32** %56
%58 = getelementptr inbounds i32, i32* %57, i64 1
store i32 2, i32* %58
%59 = load i32*, i32** %6
%60 = getelementptr inbounds i32, i32* %59, i64 2
store i32 2, i32* %60
%61 = call i8* @malloc(i32 8)
%62 = bitcast i8* %61 to i32*
%63 = load i32**, i32*** %5
%64 = getelementptr inbounds i32*, i32** %63, i64 3
store i32* %62, i32** %64
%65 = load i32**, i32*** %5
%66 = getelementptr inbounds i32*, i32** %65, i64 3
%67 = load i32*, i32** %66
%68 = getelementptr inbounds i32, i32* %67, i64 0
store i32 1, i32* %68
%69 = load i32**, i32*** %5
%70 = getelementptr inbounds i32*, i32** %69, i64 3
%71 = load i32*, i32** %70
%72 = getelementptr inbounds i32, i32* %71, i64 1
store i32 3, i32* %72
%73 = load i32*, i32** %6
%74 = getelementptr inbounds i32, i32* %73, i64 3
store i32 2, i32* %74
%75 = call i8* @malloc(i32 8)
%76 = bitcast i8* %75 to i32*
%77 = load i32**, i32*** %5
%78 = getelementptr inbounds i32*, i32** %77, i64 4
store i32* %76, i32** %78
%79 = load i32**, i32*** %5
%80 = getelementptr inbounds i32*, i32** %79, i64 4
%81 = load i32*, i32** %80
%82 = getelementptr inbounds i32, i32* %81, i64 0
store i32 4, i32* %82
%83 = load i32**, i32*** %5
%84 = getelementptr inbounds i32*, i32** %83, i64 4
%85 = load i32*, i32** %84
%86 = getelementptr inbounds i32, i32* %85, i64 1
store i32 0, i32* %86
%87 = load i32*, i32** %6
%88 = getelementptr inbounds i32, i32* %87, i64 4
store i32 2, i32* %88
%89 = call i8* @malloc(i32 8)
%90 = bitcast i8* %89 to i32*
%91 = load i32**, i32*** %5
%92 = getelementptr inbounds i32*, i32** %91, i64 5
store i32* %90, i32** %92
%93 = load i32**, i32*** %5
%94 = getelementptr inbounds i32*, i32** %93, i64 5
%95 = load i32*, i32** %94
%96 = getelementptr inbounds i32, i32* %95, i64 0
store i32 0, i32* %96
%97 = load i32**, i32*** %5
%98 = getelementptr inbounds i32*, i32** %97, i64 5
%99 = load i32*, i32** %98
%100 = getelementptr inbounds i32, i32* %99, i64 1
store i32 5, i32* %100
%101 = load i32*, i32** %6
%102 = getelementptr inbounds i32, i32* %101, i64 5
store i32 2, i32* %102
%103 = load i32, i32* %3
%104 = load i32**, i32*** %5
%105 = load i32, i32* %4
%106 = load i32*, i32** %6
%107 = call i64 @canFinish(i32 %103, i32** %104, i32 %105, i32* %106)
%108 = icmp ne i64 %107, 0
%109 = zext i1 %108 to i64
%110 = select i1 %108, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%111 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %110)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(48) i8* @malloc(i32 48)
%2 = bitcast i8* %1 to i32**
%3 = tail call dereferenceable_or_null(24) i8* @malloc(i32 24)
%4 = bitcast i8* %3 to i32*
%5 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%6 = bitcast i8* %5 to i32*
%7 = bitcast i8* %1 to i8**
store i8* %5, i8** %7
store i32 1, i32* %6
%8 = getelementptr inbounds i32, i32* %6, i64 1
store i32 0, i32* %8
%9 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%10 = bitcast i8* %9 to i32*
%11 = getelementptr inbounds i32*, i32** %2, i64 1
%12 = bitcast i32** %11 to i8**
store i8* %9, i8** %12
store i32 2, i32* %10
%13 = getelementptr inbounds i32, i32* %10, i64 1
store i32 1, i32* %13
%14 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%15 = bitcast i8* %14 to i32*
%16 = getelementptr inbounds i32*, i32** %2, i64 2
%17 = bitcast i32** %16 to i8**
store i8* %14, i8** %17
store i32 3, i32* %15
%18 = getelementptr inbounds i32, i32* %15, i64 1
store i32 2, i32* %18
%19 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%20 = bitcast i8* %19 to i32*
%21 = getelementptr inbounds i32*, i32** %2, i64 3
%22 = bitcast i32** %21 to i8**
store i8* %19, i8** %22
store i32 1, i32* %20
%23 = getelementptr inbounds i32, i32* %20, i64 1
store i32 3, i32* %23
%24 = bitcast i8* %3 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x i32>* %24
%25 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%26 = bitcast i8* %25 to i32*
%27 = getelementptr inbounds i32*, i32** %2, i64 4
%28 = bitcast i32** %27 to i8**
store i8* %25, i8** %28
store i32 4, i32* %26
%29 = getelementptr inbounds i32, i32* %26, i64 1
store i32 0, i32* %29
%30 = getelementptr inbounds i32, i32* %4, i64 4
store i32 2, i32* %30
%31 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%32 = bitcast i8* %31 to i32*
%33 = getelementptr inbounds i32*, i32** %2, i64 5
%34 = bitcast i32** %33 to i8**
store i8* %31, i8** %34
store i32 0, i32* %32
%35 = getelementptr inbounds i32, i32* %32, i64 1
store i32 5, i32* %35
%36 = getelementptr inbounds i32, i32* %4, i64 5
store i32 2, i32* %36
%37 = tail call i64 @canFinish(i32 6, i32** %2, i32 6, i32* %4)
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %39)
ret i32 0
}