#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 node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inOrderTraversal(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ swapNodesUtil(struct node *, int /*<<< orphan*/, int);
void swapNodes(struct node *root) {
  int t, a;
  scanf("%d", &t);
  while (t--) {
    int i;
    scanf("%d", &a);
    swapNodesUtil(root, 0, a);
    inOrderTraversal(root);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<swapNodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11a8 <swapNodes+0x68>
lea    0xe89(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
xor    %esi,%esi
call   1040 <swapNodesUtil@plt>
mov    -0x8(%rbp),%rdi
call   1050 <inOrderTraversal@plt>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <swapNodes+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapNodes>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xead(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
subl   $0x1,0x8(%rsp)
jb     11a2 <swapNodes+0x62>
lea    0xe95(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <swapNodesUtil@plt>
mov    %rbx,%rdi
call   1050 <inOrderTraversal@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0x8(%rsp)
jae    1170 <swapNodes+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @swapNodes(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store %struct.node* %0, %struct.node** %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %11, %1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = load %struct.node*, %struct.node** %2
%14 = load i32, i32* %4
%15 = call i32 @swapNodesUtil(%struct.node* %13, i32 0, i32 %14)
%16 = load %struct.node*, %struct.node** %2
%17 = call i32 @inOrderTraversal(%struct.node* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @swapNodes(%struct.node* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp eq i32 %7, 0
br i1 %9, label %19, label %10
10: ; preds = %1, %10
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 @swapNodesUtil(%struct.node* %0, i32 0, i32 %12)
%14 = call i32 @inOrderTraversal(%struct.node* %0)
%15 = call i32 @putchar(i32 10)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
%18 = icmp eq i32 %16, 0
br i1 %18, label %19, label %10
19: ; preds = %10, %1
ret void
}