#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 */

/* Variables and functions */
int b(int, int, int, int);
int shuffle(int i, int j, int k) {
  return (b(i, j, k, 0) + b(j, k, i, 1) + b(k, i, j, 2) + b(i, j, k, 3) +
          b(j, k, i, 4) + b(k, i, j, 5) + b(i, j, k, 6) + b(j, k, i, 7));
}


x86 assembly (clang, -O0):
<shuffle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
call   1030 <b@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    $0x1,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x2,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x3,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    $0x4,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x5,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x6,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    $0x7,%ecx
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shuffle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r13d
mov    %edi,%r12d
xor    %ecx,%ecx
call   1030 <b@plt>
mov    %eax,%r15d
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    $0x1,%ecx
call   1030 <b@plt>
mov    %eax,%ebp
add    %r15d,%ebp
mov    %r14d,%edi
mov    %r12d,%esi
mov    %r13d,%edx
mov    $0x2,%ecx
call   1030 <b@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r14d,%edx
mov    $0x3,%ecx
call   1030 <b@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    $0x4,%ecx
call   1030 <b@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r14d,%edi
mov    %r12d,%esi
mov    %r13d,%edx
mov    $0x5,%ecx
call   1030 <b@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r12d,%edi
mov    %r13d,%esi
mov    %r14d,%edx
mov    $0x6,%ecx
call   1030 <b@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r12d,%edx
mov    $0x7,%ecx
call   1030 <b@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @shuffle(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @b(i32 %7, i32 %8, i32 %9, i32 0)
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = call i32 @b(i32 %11, i32 %12, i32 %13, i32 1)
%15 = add nsw i32 %10, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @b(i32 %16, i32 %17, i32 %18, i32 2)
%20 = add nsw i32 %15, %19
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call i32 @b(i32 %21, i32 %22, i32 %23, i32 3)
%25 = add nsw i32 %20, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = load i32, i32* %4
%29 = call i32 @b(i32 %26, i32 %27, i32 %28, i32 4)
%30 = add nsw i32 %25, %29
%31 = load i32, i32* %6
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = call i32 @b(i32 %31, i32 %32, i32 %33, i32 5)
%35 = add nsw i32 %30, %34
%36 = load i32, i32* %4
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = call i32 @b(i32 %36, i32 %37, i32 %38, i32 6)
%40 = add nsw i32 %35, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = load i32, i32* %4
%44 = call i32 @b(i32 %41, i32 %42, i32 %43, i32 7)
%45 = add nsw i32 %40, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @shuffle(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @b(i32 %0, i32 %1, i32 %2, i32 0)
%5 = tail call i32 @b(i32 %1, i32 %2, i32 %0, i32 1)
%6 = add nsw i32 %5, %4
%7 = tail call i32 @b(i32 %2, i32 %0, i32 %1, i32 2)
%8 = add nsw i32 %6, %7
%9 = tail call i32 @b(i32 %0, i32 %1, i32 %2, i32 3)
%10 = add nsw i32 %8, %9
%11 = tail call i32 @b(i32 %1, i32 %2, i32 %0, i32 4)
%12 = add nsw i32 %10, %11
%13 = tail call i32 @b(i32 %2, i32 %0, i32 %1, i32 5)
%14 = add nsw i32 %12, %13
%15 = tail call i32 @b(i32 %0, i32 %1, i32 %2, i32 6)
%16 = add nsw i32 %14, %15
%17 = tail call i32 @b(i32 %1, i32 %2, i32 %0, i32 7)
%18 = add nsw i32 %16, %17
ret i32 %18
}