#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_black(struct cl_node *);
scalar_t__ cl_node_is_red(struct cl_node *);
int /*<<< orphan*/ cl_node_left(struct cl_node *);
struct cl_node *cl_node_red(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 *, int /*<<< orphan*/);
struct cl_node *cl_node_rotate_left(struct cl_node *n) {
  struct cl_node *p = cl_node_right(n);
  cl_node_set_right(n, cl_node_left(p));
  cl_node_set_left(p, cl_node_red(n));
  return cl_node_is_red(n) ? cl_node_red(p) : cl_node_black(p);
}


x86 assembly (clang, -O0):
<cl_node_rotate_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cl_node_right@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <cl_node_left@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1070 <cl_node_set_right@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <cl_node_red@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1030 <cl_node_set_left@plt>
mov    -0x8(%rbp),%rdi
call   1050 <cl_node_is_red@plt>
cmp    $0x0,%rax
je     11e7 <cl_node_rotate_left+0x77>
mov    -0x10(%rbp),%rdi
call   1060 <cl_node_red@plt>
mov    %rax,-0x28(%rbp)
jmp    11f4 <cl_node_rotate_left+0x84>
mov    -0x10(%rbp),%rdi
call   1090 <cl_node_black@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_node_rotate_left>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <cl_node_right@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1080 <cl_node_left@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <cl_node_set_right@plt>
mov    %rbx,%rdi
call   1060 <cl_node_red@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <cl_node_set_left@plt>
mov    %rbx,%rdi
call   1050 <cl_node_is_red@plt>
mov    %r14,%rdi
add    $0x8,%rsp
test   %rax,%rax
je     11c0 <cl_node_rotate_left+0x50>
pop    %rbx
pop    %r14
jmp    1060 <cl_node_red@plt>
pop    %rbx
pop    %r14
jmp    1090 <cl_node_black@plt>

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

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