#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 */
struct node *get_king_moves_black(struct node *, char *, struct node *);
struct node *get_king_moves_white(struct node *, char *, struct node *);
struct node *get_king_moves(struct node *currentNode, char *board,
                            int isWhitesMove, struct node *parentNode) {
  if (isWhitesMove == 1) {
    return get_king_moves_white(currentNode, board, parentNode);
  } else {
    return get_king_moves_black(currentNode, board, parentNode);
  }
}


x86 assembly (clang, -O0):
<get_king_moves>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    115b <get_king_moves+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <get_king_moves_white@plt>
mov    %rax,-0x8(%rbp)
jmp    1170 <get_king_moves+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <get_king_moves_black@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_king_moves>:
cmp    $0x1,%edx
jne    112d <get_king_moves+0xd>
mov    %rcx,%rdx
jmp    1030 <get_king_moves_white@plt>
mov    %rcx,%rdx
jmp    1040 <get_king_moves_black@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define %struct.node* @get_king_moves(%struct.node* %0, i8* %1, i32 %2, %struct.node* %3) {
%5 = alloca %struct.node*
%6 = alloca %struct.node*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.node*
store %struct.node* %0, %struct.node** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store %struct.node* %3, %struct.node** %9
%10 = load i32, i32* %8
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load %struct.node*, %struct.node** %6
%14 = load i8*, i8** %7
%15 = load %struct.node*, %struct.node** %9
%16 = call %struct.node* @get_king_moves_white(%struct.node* %13, i8* %14, %struct.node* %15)
store %struct.node* %16, %struct.node** %5
br label %22
17: ; preds = %4
%18 = load %struct.node*, %struct.node** %6
%19 = load i8*, i8** %7
%20 = load %struct.node*, %struct.node** %9
%21 = call %struct.node* @get_king_moves_black(%struct.node* %18, i8* %19, %struct.node* %20)
store %struct.node* %21, %struct.node** %5
br label %22
22: ; preds = %17, %12
%23 = load %struct.node*, %struct.node** %5
ret %struct.node* %23
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @get_king_moves(%struct.node* %0, i8* %1, i32 %2, %struct.node* %3) {
%5 = icmp eq i32 %2, 1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call %struct.node* @get_king_moves_white(%struct.node* %0, i8* %1, %struct.node* %3)
br label %10
8: ; preds = %4
%9 = tail call %struct.node* @get_king_moves_black(%struct.node* %0, i8* %1, %struct.node* %3)
br label %10
10: ; preds = %8, %6
%11 = phi %struct.node* [ %7, %6 ], [ %9, %8 ]
ret %struct.node* %11
}