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

/* Variables and functions */
int preorder(struct binTree *, struct binTree *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int checkIfSubTree(struct binTree *tree, struct binTree *subTree) {
  if (preorder(tree, subTree, 0) == 1) {
    printf("Yes it is a subtree\n");
    return 1;
  } else {
    printf("\nNo");
    return 0;
  }
}


x86 assembly (clang, -O0):
<checkIfSubTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <preorder@plt>
cmp    $0x1,%eax
jne    1160 <checkIfSubTree+0x40>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1173 <checkIfSubTree+0x53>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfSubTree>:
push   %rbx
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <preorder@plt>
cmp    $0x1,%eax
jne    1152 <checkIfSubTree+0x22>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    115e <checkIfSubTree+0x2e>
lea    0xea7(%rip),%rdi
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.binTree = type { i32 }
@.str = [21 x i8] c"Yes it is a subtree\0A\00"
@.str.1 = [4 x i8] c"\0ANo\00"
define i32 @checkIfSubTree(%struct.binTree* %0, %struct.binTree* %1) {
%3 = alloca i32
%4 = alloca %struct.binTree*
%5 = alloca %struct.binTree*
store %struct.binTree* %0, %struct.binTree** %4
store %struct.binTree* %1, %struct.binTree** %5
%6 = load %struct.binTree*, %struct.binTree** %4
%7 = load %struct.binTree*, %struct.binTree** %5
%8 = call i32 @preorder(%struct.binTree* %6, %struct.binTree* %7, i32 0)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.binTree = type { i32 }
@.str.1 = [4 x i8] c"\0ANo\00"
@str = [20 x i8] c"Yes it is a subtree\00"
define i32 @checkIfSubTree(%struct.binTree* %0, %struct.binTree* %1) {
%3 = tail call i32 @preorder(%struct.binTree* %0, %struct.binTree* %1, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %10
}