#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 adjmat_t {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(struct adjmat_t *);
scalar_t__ issparse(struct adjmat_t *);
int /*<<< orphan*/ make_adjacency_matrix(struct adjmat_t **);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ read_adjacency_matrix(struct adjmat_t *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ show_adjacency_matrix(struct adjmat_t *);
int main(int argc, char *argsv[]) {
  FILE *fp = fopen("input.txt", "r");
  struct adjmat_t *graph;
  make_adjacency_matrix(&graph);
  read_adjacency_matrix(graph, fp);
  show_adjacency_matrix(graph);
  if (issparse(graph)) {
    puts("The graph is sparse.");
  }
  fclose(fp);
  free(graph);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe66(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <make_adjacency_matrix@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <read_adjacency_matrix@plt>
mov    -0x20(%rbp),%rdi
call   1080 <show_adjacency_matrix@plt>
mov    -0x20(%rbp),%rdi
call   1070 <issparse@plt>
cmp    $0x0,%rax
je     11eb <main+0x6b>
lea    0xe26(%rip),%rdi
call   1050 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe74(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
call   1040 <make_adjacency_matrix@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   10a0 <read_adjacency_matrix@plt>
mov    0x8(%rsp),%rdi
call   1080 <show_adjacency_matrix@plt>
mov    0x8(%rsp),%rdi
call   1070 <issparse@plt>
test   %rax,%rax
je     11d7 <main+0x57>
lea    0xe3a(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.adjmat_t = type { i32 }
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"The graph is sparse.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.adjmat_t*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %6
%9 = call i32 @make_adjacency_matrix(%struct.adjmat_t** %7)
%10 = load %struct.adjmat_t*, %struct.adjmat_t** %7
%11 = load i32*, i32** %6
%12 = call i32 @read_adjacency_matrix(%struct.adjmat_t* %10, i32* %11)
%13 = load %struct.adjmat_t*, %struct.adjmat_t** %7
%14 = call i32 @show_adjacency_matrix(%struct.adjmat_t* %13)
%15 = load %struct.adjmat_t*, %struct.adjmat_t** %7
%16 = call i64 @issparse(%struct.adjmat_t* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %2
%21 = load i32*, i32** %6
%22 = call i32 @fclose(i32* %21)
%23 = load %struct.adjmat_t*, %struct.adjmat_t** %7
%24 = call i32 @free(%struct.adjmat_t* %23)
ret i32 0
}

LLVM IR (-O2):
%struct.adjmat_t = type { i32 }
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"The graph is sparse.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.adjmat_t*
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast %struct.adjmat_t** %3 to i8*
%6 = call i32 @make_adjacency_matrix(%struct.adjmat_t** %3)
%7 = load %struct.adjmat_t*, %struct.adjmat_t** %3
%8 = call i32 @read_adjacency_matrix(%struct.adjmat_t* %7, i32* %4)
%9 = load %struct.adjmat_t*, %struct.adjmat_t** %3
%10 = call i32 @show_adjacency_matrix(%struct.adjmat_t* %9)
%11 = load %struct.adjmat_t*, %struct.adjmat_t** %3
%12 = call i64 @issparse(%struct.adjmat_t* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %2
%17 = call i32 @fclose(i32* %4)
%18 = load %struct.adjmat_t*, %struct.adjmat_t** %3
%19 = call i32 @free(%struct.adjmat_t* %18)
ret i32 0
}