#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(struct cl_node *);
struct cl_node *cl_node_left(struct cl_node *);
struct cl_node *cl_node_rotate_right(struct cl_node *);
struct cl_node *cl_node_move_red_right(struct cl_node *n) {
  n = cl_node_flip_colors(n);
  if (cl_node_is_red(cl_node_left(cl_node_left(n))))
    return cl_node_flip_colors(cl_node_rotate_right(n));
  else
    return n;
}


x86 assembly (clang, -O0):
<cl_node_move_red_right>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <cl_node_flip_colors@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <cl_node_left@plt>
mov    %rax,%rdi
call   1050 <cl_node_left@plt>
mov    %rax,%rdi
call   1030 <cl_node_is_red@plt>
cmp    $0x0,%rax
je     1196 <cl_node_move_red_right+0x56>
mov    -0x10(%rbp),%rdi
call   1060 <cl_node_rotate_right@plt>
mov    %rax,%rdi
call   1040 <cl_node_flip_colors@plt>
mov    %rax,-0x8(%rbp)
jmp    119e <cl_node_move_red_right+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_node_move_red_right>:
push   %rbx
call   1040 <cl_node_flip_colors@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <cl_node_left@plt>
mov    %rax,%rdi
call   1050 <cl_node_left@plt>
mov    %rax,%rdi
call   1030 <cl_node_is_red@plt>
test   %rax,%rax
je     1177 <cl_node_move_red_right+0x37>
mov    %rbx,%rdi
call   1060 <cl_node_rotate_right@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <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_right(%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 %struct.cl_node* @cl_node_left(%struct.cl_node* %6)
%8 = call %struct.cl_node* @cl_node_left(%struct.cl_node* %7)
%9 = call i64 @cl_node_is_red(%struct.cl_node* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load %struct.cl_node*, %struct.cl_node** %3
%13 = call %struct.cl_node* @cl_node_rotate_right(%struct.cl_node* %12)
%14 = call %struct.cl_node* @cl_node_flip_colors(%struct.cl_node* %13)
store %struct.cl_node* %14, %struct.cl_node** %2
br label %17
15: ; preds = %1
%16 = load %struct.cl_node*, %struct.cl_node** %3
store %struct.cl_node* %16, %struct.cl_node** %2
br label %17
17: ; preds = %15, %11
%18 = load %struct.cl_node*, %struct.cl_node** %2
ret %struct.cl_node* %18
}

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