#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_colors(struct cl_node *);
scalar_t__ cl_node_is_red(int /*<<< orphan*/);
int /*<<< orphan*/ cl_node_left(int /*<<< orphan*/);
int /*<<< orphan*/ cl_node_right(struct cl_node *);
struct cl_node *cl_node_rotate_left(struct cl_node *);
int /*<<< orphan*/ cl_node_rotate_right(int /*<<< orphan*/);
int /*<<< orphan*/ cl_node_set_right(struct cl_node *, int /*<<< orphan*/);
struct cl_node *cl_node_move_red_left(struct cl_node *n) {
  n = cl_node_flip_colors(n);
  if (cl_node_is_red(cl_node_left(cl_node_right(n)))) {
    cl_node_set_right(n, cl_node_rotate_right(cl_node_right(n)));
    return cl_node_flip_colors(cl_node_rotate_left(n));
  } else
    return n;
}


x86 assembly (clang, -O0):
<cl_node_move_red_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <cl_node_flip_colors@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <cl_node_right@plt>
mov    %eax,%edi
call   1080 <cl_node_left@plt>
mov    %eax,%edi
call   1040 <cl_node_is_red@plt>
cmp    $0x0,%rax
je     11e7 <cl_node_move_red_left+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <cl_node_right@plt>
mov    %eax,%edi
call   1090 <cl_node_rotate_right@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1060 <cl_node_set_right@plt>
mov    -0x10(%rbp),%rdi
call   1070 <cl_node_rotate_left@plt>
mov    %rax,%rdi
call   1050 <cl_node_flip_colors@plt>
mov    %rax,-0x8(%rbp)
jmp    11ef <cl_node_move_red_left+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_node_move_red_left>:
push   %rbx
call   1050 <cl_node_flip_colors@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <cl_node_right@plt>
mov    %eax,%edi
call   1080 <cl_node_left@plt>
mov    %eax,%edi
call   1040 <cl_node_is_red@plt>
test   %rax,%rax
je     11be <cl_node_move_red_left+0x4e>
mov    %rbx,%rdi
call   1030 <cl_node_right@plt>
mov    %eax,%edi
call   1090 <cl_node_rotate_right@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <cl_node_set_right@plt>
mov    %rbx,%rdi
call   1070 <cl_node_rotate_left@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1050 <cl_node_flip_colors@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.cl_node = type { i32 }
define %struct.cl_node* @cl_node_move_red_left(%struct.cl_node* %0) {
%2 = alloca %struct.cl_node*
%3 = alloca %struct.cl_node*
store %struct.cl_node* %0, %struct.cl_node** %3
%4 = load %struct.cl_node*, %struct.cl_node** %3
%5 = call %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %4)
store %struct.cl_node* %5, %struct.cl_node** %3
%6 = load %struct.cl_node*, %struct.cl_node** %3
%7 = call i32 @cl_node_right(%struct.cl_node* %6)
%8 = call i32 @cl_node_left(i32 %7)
%9 = call i64 @cl_node_is_red(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %1
%12 = load %struct.cl_node*, %struct.cl_node** %3
%13 = load %struct.cl_node*, %struct.cl_node** %3
%14 = call i32 @cl_node_right(%struct.cl_node* %13)
%15 = call i32 @cl_node_rotate_right(i32 %14)
%16 = call i32 @cl_node_set_right(%struct.cl_node* %12, i32 %15)
%17 = load %struct.cl_node*, %struct.cl_node** %3
%18 = call %struct.cl_node* @cl_node_rotate_left(%struct.cl_node* %17)
%19 = call %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %18)
store %struct.cl_node* %19, %struct.cl_node** %2
br label %22
20: ; preds = %1
%21 = load %struct.cl_node*, %struct.cl_node** %3
store %struct.cl_node* %21, %struct.cl_node** %2
br label %22
22: ; preds = %20, %11
%23 = load %struct.cl_node*, %struct.cl_node** %2
ret %struct.cl_node* %23
}

LLVM IR (-O2):
%struct.cl_node = type { i32 }
define %struct.cl_node* @cl_node_move_red_left(%struct.cl_node* %0) {
%2 = tail call %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %0)
%3 = tail call i32 @cl_node_right(%struct.cl_node* %2)
%4 = tail call i32 @cl_node_left(i32 %3)
%5 = tail call i64 @cl_node_is_red(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = tail call i32 @cl_node_right(%struct.cl_node* %2)
%9 = tail call i32 @cl_node_rotate_right(i32 %8)
%10 = tail call i32 @cl_node_set_right(%struct.cl_node* %2, i32 %9)
%11 = tail call %struct.cl_node* @cl_node_rotate_left(%struct.cl_node* %2)
%12 = tail call %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %11)
br label %13
13: ; preds = %1, %7
%14 = phi %struct.cl_node* [ %12, %7 ], [ %2, %1 ]
ret %struct.cl_node* %14
}