#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 */
int /*<<< orphan*/ printf(char *, int);
void __dfs(int (*a)[100], int n, int v, int *visited) {
  visited[v] = 1;
  printf("%d\t", v);
  int i;
  for (i = 1; i <= n; ++i) {
    if (!visited[i] && a[v][i])
      __dfs(a, n, i, visited);
  }
}


x86 assembly (clang, -O0):
<__dfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11bf <__dfs+0x9f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11ac <__dfs+0x8c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11ac <__dfs+0x8c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1040 <__dfs@plt>
jmp    11b1 <__dfs+0x91>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <__dfs+0x3b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dfs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %esi,%r14d
mov    %rdi,%r15
movslq %edx,%rbx
movl   $0x1,(%rcx,%rbx,4)
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
test   %r14d,%r14d
jle    1199 <__dfs+0x79>
lea    0x1(%r14),%r13d
imul   $0x190,%rbx,%rbp
add    %r15,%rbp
mov    $0x1,%ebx
jmp    1179 <__dfs+0x59>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1199 <__dfs+0x79>
cmpl   $0x0,(%r12,%rbx,4)
jne    1170 <__dfs+0x50>
cmpl   $0x0,0x0(%rbp,%rbx,4)
je     1170 <__dfs+0x50>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r12,%rcx
call   1040 <__dfs@plt>
jmp    1170 <__dfs+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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