#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*/ BFS(int **, int *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int matrix[5][5] = {0};
  int i, j, s[5] = {0};
  while (1) {
    scanf("%d%d", &i, &j);
    if (i == j)
      break;
    matrix[i][j] = 1;
    matrix[j][i] = 1;
  }
  BFS(matrix, s, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    0xe94(%rip),%rdi
lea    -0x74(%rbp),%rsi
lea    -0x78(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jne    118a <main+0x5a>
jmp    11c3 <main+0x93>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movslq -0x78(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x74(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    1165 <main+0x35>
lea    -0x70(%rbp),%rdi
lea    -0x90(%rbp),%rsi
xor    %edx,%edx
call   1030 <BFS@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x0,0x90(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
lea    0xe91(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
je     11e2 <main+0xc2>
lea    0xe6f(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
cltq
movslq %ecx,%rcx
lea    (%rax,%rax,4),%rdx
lea    (%rsp,%rdx,4),%rdx
add    $0x30,%rdx
movl   $0x1,(%rdx,%rcx,4)
lea    (%rcx,%rcx,4),%rcx
lea    0x30(%rsp,%rcx,4),%rcx
movl   $0x1,(%rcx,%rax,4)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
jne    11a0 <main+0x80>
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
xor    %edx,%edx
call   1030 <BFS@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [5 x i32]
store i32 0, i32* %1
%6 = bitcast [5 x [5 x i32]]* %2 to i8*
%7 = bitcast [5 x i32]* %5 to i8*
br label %8
8: ; preds = %0, %14
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %8
br label %27
14: ; preds = %8
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %17, i64 0, i64 %19
store i32 1, i32* %20
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %22
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %23, i64 0, i64 %25
store i32 1, i32* %26
br label %8
27: ; preds = %13
%28 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%29 = bitcast [5 x i32]* %28 to i32**
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%31 = call i32 @BFS(i32** %29, i32* %30, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x i32]
%5 = bitcast [5 x [5 x i32]]* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [5 x i32]* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %10, %11
br i1 %12, label %24, label %13
13: ; preds = %0, %13
%14 = phi i32 [ %22, %13 ], [ %11, %0 ]
%15 = phi i32 [ %21, %13 ], [ %10, %0 ]
%16 = sext i32 %15 to i64
%17 = sext i32 %14 to i64
%18 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %16, i64 %17
store i32 1, i32* %18
%19 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %17, i64 %16
store i32 1, i32* %19
%20 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %13
24: ; preds = %13, %0
%25 = bitcast [5 x [5 x i32]]* %1 to i32**
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%27 = call i32 @BFS(i32** %25, i32* %26, i32 0)
ret i32 0
}