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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void print_dot_input(int cfg[][1000], int no_of_vertices, const char *name,
                     FILE *fp) {
  int i, j;
  fprintf(fp, "digraph %s {\n", name);
  for (i = 0; i < no_of_vertices; i++)
    for (j = 0; j < no_of_vertices; j++)
      if (cfg[i][j] == 1)
        fprintf(fp, "%d -> %d\n", i, j);
  fprintf(fp, "}\n");
}


x86 assembly (clang, -O0):
<print_dot_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c1 <print_dot_input+0xb1>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ae <print_dot_input+0x9e>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0xfa0,%rcx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    119b <print_dot_input+0x8b>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a0 <print_dot_input+0x90>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1157 <print_dot_input+0x47>
jmp    11b3 <print_dot_input+0xa3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <print_dot_input+0x34>
mov    -0x20(%rbp),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dot_input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %esi,%ebx
mov    %rdi,%r13
lea    0xec6(%rip),%rsi
mov    %rcx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebx,%ebx
jle    11a5 <print_dot_input+0x85>
mov    %ebx,%ebp
lea    0xebd(%rip),%r15
xor    %r12d,%r12d
jmp    1170 <print_dot_input+0x50>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0xfa0,%r13
cmp    %rbp,%r12
je     11a5 <print_dot_input+0x85>
xor    %ebx,%ebx
jmp    1189 <print_dot_input+0x69>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1160 <print_dot_input+0x40>
cmpl   $0x1,0x0(%r13,%rbx,4)
jne    1180 <print_dot_input+0x60>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1180 <print_dot_input+0x60>
lea    0xe6c(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"digraph %s {\0A\00"
@.str.1 = [10 x i8] c"%d -> %d\0A\00"
@.str.2 = [3 x i8] c"}\0A\00"
define void @print_dot_input([1000 x i32]* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca [1000 x i32]*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store [1000 x i32]* %0, [1000 x i32]** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%11 = load i32*, i32** %8
%12 = load i8*, i8** %7
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %9
br label %14
14: ; preds = %43, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %46
18: ; preds = %14
store i32 0, i32* %10
br label %19
19: ; preds = %39, %18
%20 = load i32, i32* %10
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %42
23: ; preds = %19
%24 = load [1000 x i32]*, [1000 x i32]** %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1000 x i32], [1000 x i32]* %24, i64 %26
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [1000 x i32], [1000 x i32]* %27, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %38
33: ; preds = %23
%34 = load i32*, i32** %8
%35 = load i32, i32* %9
%36 = load i32, i32* %10
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %36)
br label %38
38: ; preds = %33, %23
br label %39
39: ; preds = %38
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %19
42: ; preds = %19
br label %43
43: ; preds = %42
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %14
46: ; preds = %14
%47 = load i32*, i32** %8
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"digraph %s {\0A\00"
@.str.1 = [10 x i8] c"%d -> %d\0A\00"
@.str.2 = [3 x i8] c"}\0A\00"
define void @print_dot_input([1000 x i32]* nocapture %0, i32 %1, i8* %2, i32* nocapture %3) {
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %23, %7
%10 = phi i64 [ 0, %7 ], [ %24, %23 ]
%11 = trunc i64 %10 to i32
br label %12
12: ; preds = %9, %20
%13 = phi i64 [ 0, %9 ], [ %21, %20 ]
%14 = getelementptr inbounds [1000 x i32], [1000 x i32]* %0, i64 %10, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = trunc i64 %13 to i32
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %18)
br label %20
20: ; preds = %12, %17
%21 = add nuw nsw i64 %13, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %23, label %12
23: ; preds = %20
%24 = add nuw nsw i64 %10, 1
%25 = icmp eq i64 %24, %8
br i1 %25, label %26, label %9
26: ; preds = %23, %4
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %3)
ret void
}