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

/* Variables and functions */
struct splaytree_node *get_left(struct splaytree_node *);
struct splaytree_node *get_right(struct splaytree_node *);
int /*<<< orphan*/ set_left(struct splaytree_node *, struct splaytree_node *);
int /*<<< orphan*/ set_next(struct splaytree_node *, struct splaytree_node *);
int /*<<< orphan*/ set_right(struct splaytree_node *, struct splaytree_node *);
void rotate_left(struct splaytree_node *node) {
  struct splaytree_node *right = get_right(node);
  struct splaytree_node *l = get_left(right);
  if (l)
    set_right(l, node);
  else
    set_next(right, node);
  set_left(node, right);
}


x86 assembly (clang, -O0):
<rotate_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_right@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <get_left@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1193 <rotate_left+0x43>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <set_right@plt>
jmp    11a0 <rotate_left+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <set_next@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <set_left@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate_left>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <get_right@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <get_left@plt>
test   %rax,%rax
je     1179 <rotate_left+0x29>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1060 <set_right@plt>
jmp    1184 <rotate_left+0x34>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <set_next@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <set_left@plt>

LLVM IR (-O0):
%struct.splaytree_node = type { i32 }
define void @rotate_left(%struct.splaytree_node* %0) {
%2 = alloca %struct.splaytree_node*
%3 = alloca %struct.splaytree_node*
%4 = alloca %struct.splaytree_node*
store %struct.splaytree_node* %0, %struct.splaytree_node** %2
%5 = load %struct.splaytree_node*, %struct.splaytree_node** %2
%6 = call %struct.splaytree_node* @get_right(%struct.splaytree_node* %5)
store %struct.splaytree_node* %6, %struct.splaytree_node** %3
%7 = load %struct.splaytree_node*, %struct.splaytree_node** %3
%8 = call %struct.splaytree_node* @get_left(%struct.splaytree_node* %7)
store %struct.splaytree_node* %8, %struct.splaytree_node** %4
%9 = load %struct.splaytree_node*, %struct.splaytree_node** %4
%10 = icmp ne %struct.splaytree_node* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load %struct.splaytree_node*, %struct.splaytree_node** %4
%13 = load %struct.splaytree_node*, %struct.splaytree_node** %2
%14 = call i32 @set_right(%struct.splaytree_node* %12, %struct.splaytree_node* %13)
br label %19
15: ; preds = %1
%16 = load %struct.splaytree_node*, %struct.splaytree_node** %3
%17 = load %struct.splaytree_node*, %struct.splaytree_node** %2
%18 = call i32 @set_next(%struct.splaytree_node* %16, %struct.splaytree_node* %17)
br label %19
19: ; preds = %15, %11
%20 = load %struct.splaytree_node*, %struct.splaytree_node** %2
%21 = load %struct.splaytree_node*, %struct.splaytree_node** %3
%22 = call i32 @set_left(%struct.splaytree_node* %20, %struct.splaytree_node* %21)
ret void
}

LLVM IR (-O2):
%struct.splaytree_node = type { i32 }
define void @rotate_left(%struct.splaytree_node* %0) {
%2 = tail call %struct.splaytree_node* @get_right(%struct.splaytree_node* %0)
%3 = tail call %struct.splaytree_node* @get_left(%struct.splaytree_node* %2)
%4 = icmp eq %struct.splaytree_node* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @set_right(%struct.splaytree_node* %3, %struct.splaytree_node* %0)
br label %9
7: ; preds = %1
%8 = tail call i32 @set_next(%struct.splaytree_node* %2, %struct.splaytree_node* %0)
br label %9
9: ; preds = %7, %5
%10 = tail call i32 @set_left(%struct.splaytree_node* %0, %struct.splaytree_node* %2)
ret void
}