#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 WdStack {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ wdPeekAt(struct WdStack *, int);
int /*<<< orphan*/ wdPokeAt(int /*<<< orphan*/, struct WdStack *, int);
int32_t wdRot(struct WdStack *s) {
  int32_t n1 = wdPeekAt(s, 1);
  int32_t n2 = wdPeekAt(s, 2);
  int32_t n3 = wdPeekAt(s, 3);
  wdPokeAt(n1, s, 2);
  wdPokeAt(n2, s, 3);
  wdPokeAt(n3, s, 1);
}


x86 assembly (clang, -O0):
<wdRot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1030 <wdPokeAt@plt>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <wdPokeAt@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <wdPokeAt@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdRot>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <wdPeekAt@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <wdPokeAt@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <wdPokeAt@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <wdPokeAt@plt>

LLVM IR (-O0):
%struct.WdStack = type { i32 }
define i32 @wdRot(%struct.WdStack* %0) {
%2 = alloca i32
%3 = alloca %struct.WdStack*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.WdStack* %0, %struct.WdStack** %3
%7 = load %struct.WdStack*, %struct.WdStack** %3
%8 = call i32 @wdPeekAt(%struct.WdStack* %7, i32 1)
store i32 %8, i32* %4
%9 = load %struct.WdStack*, %struct.WdStack** %3
%10 = call i32 @wdPeekAt(%struct.WdStack* %9, i32 2)
store i32 %10, i32* %5
%11 = load %struct.WdStack*, %struct.WdStack** %3
%12 = call i32 @wdPeekAt(%struct.WdStack* %11, i32 3)
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = load %struct.WdStack*, %struct.WdStack** %3
%15 = call i32 @wdPokeAt(i32 %13, %struct.WdStack* %14, i32 2)
%16 = load i32, i32* %5
%17 = load %struct.WdStack*, %struct.WdStack** %3
%18 = call i32 @wdPokeAt(i32 %16, %struct.WdStack* %17, i32 3)
%19 = load i32, i32* %6
%20 = load %struct.WdStack*, %struct.WdStack** %3
%21 = call i32 @wdPokeAt(i32 %19, %struct.WdStack* %20, i32 1)
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.WdStack = type { i32 }
define i32 @wdRot(%struct.WdStack* %0) {
%2 = tail call i32 @wdPeekAt(%struct.WdStack* %0, i32 1)
%3 = tail call i32 @wdPeekAt(%struct.WdStack* %0, i32 2)
%4 = tail call i32 @wdPeekAt(%struct.WdStack* %0, i32 3)
%5 = tail call i32 @wdPokeAt(i32 %2, %struct.WdStack* %0, i32 2)
%6 = tail call i32 @wdPokeAt(i32 %3, %struct.WdStack* %0, i32 3)
%7 = tail call i32 @wdPokeAt(i32 %4, %struct.WdStack* %0, i32 1)
ret i32 undef
}