struct Teacher **TeacherTreeFindParent(pointer, child, CompFunc)
struct Teacher **pointer;
struct Teacher **child;
int (*CompFunc)();
{
  switch ((*CompFunc)(child, pointer)) {
  case -1:
    if (AccessTeacherTeacherTreeLSon(pointer) == child)
      return (pointer);
    else
      return (TeacherTreeFindParent(AccessTeacherTeacherTreeLSon(pointer),
                                    child, CompFunc));
  case 1:
    if (AccessTeacherTeacherTreeRSon(pointer) == child)
      return (pointer);
    else
      return (TeacherTreeFindParent(AccessTeacherTeacherTreeRSon(pointer),
                                    child, CompFunc));
  }
}


x86 assembly (clang, -O0):
<TeacherTreeFindParent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
call   *%rcx
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
sub    $0xffffffff,%eax
je     1178 <TeacherTreeFindParent+0x48>
jmp    1167 <TeacherTreeFindParent+0x37>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
je     11c0 <TeacherTreeFindParent+0x90>
jmp    1203 <TeacherTreeFindParent+0xd3>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <AccessTeacherTeacherTreeLSon@plt>
cltq
cmp    -0x18(%rbp),%rax
jne    119c <TeacherTreeFindParent+0x6c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1203 <TeacherTreeFindParent+0xd3>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <AccessTeacherTeacherTreeLSon@plt>
movslq %eax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <TeacherTreeFindParent@plt>
mov    %rax,-0x8(%rbp)
jmp    1203 <TeacherTreeFindParent+0xd3>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <AccessTeacherTeacherTreeRSon@plt>
cltq
cmp    -0x18(%rbp),%rax
jne    11e4 <TeacherTreeFindParent+0xb4>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1203 <TeacherTreeFindParent+0xd3>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <AccessTeacherTeacherTreeRSon@plt>
movslq %eax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <TeacherTreeFindParent@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TeacherTreeFindParent>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   *%r14
cmp    $0x1,%eax
je     1170 <TeacherTreeFindParent+0x50>
cmp    $0xffffffff,%eax
jne    1190 <TeacherTreeFindParent+0x70>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <AccessTeacherTeacherTreeLSon@plt>
cltq
cmp    %r15,%rax
je     1190 <TeacherTreeFindParent+0x70>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <AccessTeacherTeacherTreeLSon@plt>
movslq %eax,%rbx
jmp    1130 <TeacherTreeFindParent+0x10>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <AccessTeacherTeacherTreeRSon@plt>
cltq
cmp    %r15,%rax
je     1190 <TeacherTreeFindParent+0x70>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <AccessTeacherTeacherTreeRSon@plt>
movslq %eax,%rbx
jmp    1130 <TeacherTreeFindParent+0x10>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Teacher = type opaque
define %struct.Teacher** @TeacherTreeFindParent(%struct.Teacher** %0, %struct.Teacher** %1, i32 (...)* %2) {
%4 = alloca %struct.Teacher**
%5 = alloca %struct.Teacher**
%6 = alloca %struct.Teacher**
%7 = alloca i32 (...)*
store %struct.Teacher** %0, %struct.Teacher*** %5
store %struct.Teacher** %1, %struct.Teacher*** %6
store i32 (...)* %2, i32 (...)** %7
%8 = load i32 (...)*, i32 (...)** %7
%9 = load %struct.Teacher**, %struct.Teacher*** %6
%10 = load %struct.Teacher**, %struct.Teacher*** %5
%11 = bitcast i32 (...)* %8 to i32 (%struct.Teacher**, %struct.Teacher**, ...)*
%12 = call i32 (%struct.Teacher**, %struct.Teacher**, ...) %11(%struct.Teacher** %9, %struct.Teacher** %10)
switch i32 %12, label %47 [
i32 -1, label %13
i32 1, label %30
]
13: ; preds = %3
%14 = load %struct.Teacher**, %struct.Teacher*** %5
%15 = call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeLSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %14)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to %struct.Teacher**
%18 = load %struct.Teacher**, %struct.Teacher*** %6
%19 = icmp eq %struct.Teacher** %17, %18
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = load %struct.Teacher**, %struct.Teacher*** %5
store %struct.Teacher** %21, %struct.Teacher*** %4
br label %47
22: ; preds = %13
%23 = load %struct.Teacher**, %struct.Teacher*** %5
%24 = call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeLSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %23)
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to %struct.Teacher**
%27 = load %struct.Teacher**, %struct.Teacher*** %6
%28 = load i32 (...)*, i32 (...)** %7
%29 = call %struct.Teacher** @TeacherTreeFindParent(%struct.Teacher** %26, %struct.Teacher** %27, i32 (...)* %28)
store %struct.Teacher** %29, %struct.Teacher*** %4
br label %47
30: ; preds = %3
%31 = load %struct.Teacher**, %struct.Teacher*** %5
%32 = call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeRSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %31)
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to %struct.Teacher**
%35 = load %struct.Teacher**, %struct.Teacher*** %6
%36 = icmp eq %struct.Teacher** %34, %35
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = load %struct.Teacher**, %struct.Teacher*** %5
store %struct.Teacher** %38, %struct.Teacher*** %4
br label %47
39: ; preds = %30
%40 = load %struct.Teacher**, %struct.Teacher*** %5
%41 = call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeRSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %40)
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to %struct.Teacher**
%44 = load %struct.Teacher**, %struct.Teacher*** %6
%45 = load i32 (...)*, i32 (...)** %7
%46 = call %struct.Teacher** @TeacherTreeFindParent(%struct.Teacher** %43, %struct.Teacher** %44, i32 (...)* %45)
store %struct.Teacher** %46, %struct.Teacher*** %4
br label %47
47: ; preds = %20, %22, %37, %39, %3
%48 = load %struct.Teacher**, %struct.Teacher*** %4
ret %struct.Teacher** %48
}

LLVM IR (-O2):
%struct.Teacher = type opaque
define %struct.Teacher** @TeacherTreeFindParent(%struct.Teacher** %0, %struct.Teacher** %1, i32 (...)* %2) {
%4 = bitcast i32 (...)* %2 to i32 (%struct.Teacher**, %struct.Teacher**, ...)*
br label %5
5: ; preds = %15, %3
%6 = phi %struct.Teacher** [ %0, %3 ], [ %18, %15 ]
%7 = tail call i32 (%struct.Teacher**, %struct.Teacher**, ...) %4(%struct.Teacher** %1, %struct.Teacher** %6)
switch i32 %7, label %26 [
i32 -1, label %8
i32 1, label %19
]
8: ; preds = %5
%9 = tail call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeLSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %6)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to %struct.Teacher**
%12 = icmp eq %struct.Teacher** %11, %1
br i1 %12, label %26, label %13
13: ; preds = %8
%14 = tail call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeLSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %6)
br label %15
15: ; preds = %13, %24
%16 = phi i32 [ %14, %13 ], [ %25, %24 ]
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to %struct.Teacher**
br label %5
19: ; preds = %5
%20 = tail call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeRSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %6)
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to %struct.Teacher**
%23 = icmp eq %struct.Teacher** %22, %1
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = tail call i32 (%struct.Teacher**, ...) bitcast (i32 (...)* @AccessTeacherTeacherTreeRSon to i32 (%struct.Teacher**, ...)*)(%struct.Teacher** %6)
br label %15
26: ; preds = %19, %8, %5
ret %struct.Teacher** %6
}