#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 getbitu(unsigned char const *, int, int);
unsigned int getbitu3(const unsigned char *buff, int p1, int l1, int p2, int l2,
                      int p3, int l3) {
  return (getbitu(buff, p1, l1) << (l2 + l3)) + (getbitu(buff, p2, l2) << l3) +
         getbitu(buff, p3, l3);
}


x86 assembly (clang, -O0):
<getbitu3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <getbitu@plt>
mov    -0x18(%rbp),%ecx
add    0x10(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <getbitu@plt>
mov    %eax,%edx
mov    -0x24(%rbp),%eax
mov    0x10(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    0x10(%rbp),%edx
call   1030 <getbitu@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbitu3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,%r13d
mov    %ecx,%r12d
mov    %rdi,%r14
mov    0x40(%rsp),%r15d
call   1030 <getbitu@plt>
mov    %eax,%ebp
lea    (%r15,%r13,1),%ecx
shl    %cl,%ebp
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r13d,%edx
call   1030 <getbitu@plt>
mov    %eax,%ebx
mov    %r15d,%ecx
shl    %cl,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    0x4(%rsp),%esi
mov    %r15d,%edx
call   1030 <getbitu@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 @getbitu3(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = load i32, i32* %10
%18 = call i32 @getbitu(i8* %15, i32 %16, i32 %17)
%19 = load i32, i32* %12
%20 = load i32, i32* %14
%21 = add nsw i32 %19, %20
%22 = shl i32 %18, %21
%23 = load i8*, i8** %8
%24 = load i32, i32* %11
%25 = load i32, i32* %12
%26 = call i32 @getbitu(i8* %23, i32 %24, i32 %25)
%27 = load i32, i32* %14
%28 = shl i32 %26, %27
%29 = add nsw i32 %22, %28
%30 = load i8*, i8** %8
%31 = load i32, i32* %13
%32 = load i32, i32* %14
%33 = call i32 @getbitu(i8* %30, i32 %31, i32 %32)
%34 = add nsw i32 %29, %33
ret i32 %34
}

LLVM IR (-O2):
define i32 @getbitu3(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i32 @getbitu(i8* %0, i32 %1, i32 %2)
%9 = add nsw i32 %6, %4
%10 = shl i32 %8, %9
%11 = tail call i32 @getbitu(i8* %0, i32 %3, i32 %4)
%12 = shl i32 %11, %6
%13 = add nsw i32 %12, %10
%14 = tail call i32 @getbitu(i8* %0, i32 %5, i32 %6)
%15 = add nsw i32 %13, %14
ret i32 %15
}