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

/* Variables and functions */
struct cl_node *cl_node_flip(struct cl_node *);
struct cl_node *cl_node_left(struct cl_node *);
struct cl_node *cl_node_right(struct cl_node *);
int /*<<< orphan*/ cl_node_set_left(struct cl_node *, struct cl_node *);
int /*<<< orphan*/ cl_node_set_right(struct cl_node *, struct cl_node *);
struct cl_node *cl_node_flip_colors(struct cl_node *n) {
  cl_node_set_left(n, cl_node_flip(cl_node_left(n)));
  cl_node_set_right(n, cl_node_flip(cl_node_right(n)));
  return cl_node_flip(n);
}


x86 assembly (clang, -O0):
<cl_node_flip_colors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <cl_node_left@plt>
mov    %rax,%rdi
call   1070 <cl_node_flip@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1030 <cl_node_set_left@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cl_node_right@plt>
mov    %rax,%rdi
call   1070 <cl_node_flip@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rsi
call   1050 <cl_node_set_right@plt>
mov    -0x8(%rbp),%rdi
call   1070 <cl_node_flip@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_node_flip_colors>:
push   %rbx
mov    %rdi,%rbx
call   1060 <cl_node_left@plt>
mov    %rax,%rdi
call   1070 <cl_node_flip@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <cl_node_set_left@plt>
mov    %rbx,%rdi
call   1040 <cl_node_right@plt>
mov    %rax,%rdi
call   1070 <cl_node_flip@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <cl_node_set_right@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1070 <cl_node_flip@plt>

LLVM IR (-O0):
%struct.cl_node = type { i32 }
define %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %0) {
%2 = alloca %struct.cl_node*
store %struct.cl_node* %0, %struct.cl_node** %2
%3 = load %struct.cl_node*, %struct.cl_node** %2
%4 = load %struct.cl_node*, %struct.cl_node** %2
%5 = call %struct.cl_node* @cl_node_left(%struct.cl_node* %4)
%6 = call %struct.cl_node* @cl_node_flip(%struct.cl_node* %5)
%7 = call i32 @cl_node_set_left(%struct.cl_node* %3, %struct.cl_node* %6)
%8 = load %struct.cl_node*, %struct.cl_node** %2
%9 = load %struct.cl_node*, %struct.cl_node** %2
%10 = call %struct.cl_node* @cl_node_right(%struct.cl_node* %9)
%11 = call %struct.cl_node* @cl_node_flip(%struct.cl_node* %10)
%12 = call i32 @cl_node_set_right(%struct.cl_node* %8, %struct.cl_node* %11)
%13 = load %struct.cl_node*, %struct.cl_node** %2
%14 = call %struct.cl_node* @cl_node_flip(%struct.cl_node* %13)
ret %struct.cl_node* %14
}

LLVM IR (-O2):
%struct.cl_node = type { i32 }
define %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %0) {
%2 = tail call %struct.cl_node* @cl_node_left(%struct.cl_node* %0)
%3 = tail call %struct.cl_node* @cl_node_flip(%struct.cl_node* %2)
%4 = tail call i32 @cl_node_set_left(%struct.cl_node* %0, %struct.cl_node* %3)
%5 = tail call %struct.cl_node* @cl_node_right(%struct.cl_node* %0)
%6 = tail call %struct.cl_node* @cl_node_flip(%struct.cl_node* %5)
%7 = tail call i32 @cl_node_set_right(%struct.cl_node* %0, %struct.cl_node* %6)
%8 = tail call %struct.cl_node* @cl_node_flip(%struct.cl_node* %0)
ret %struct.cl_node* %8
}