#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 /*<<< orphan*/ getBit8(int *, int);
int /*<<< orphan*/ getBit8x(int *, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int a[] = {0, 1, 2, 3};
  getBit8(a, 2);
  getBit8x(a, 1);
  printf("%d %d %d %d", a[0], a[1], a[2], a[3]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <getBit8@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <getBit8x@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%r8d
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <getBit8@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <getBit8x@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0xc(%rsp),%r8d
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [4 x i32] [i32 0, i32 1, i32 2, i32 3]
@.str = [12 x i8] c"%d %d %d %d\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @getBit8(i32* %3, i32 2)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = call i32 @getBit8x(i32* %5, i32 1)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [4 x i32] [i32 0, i32 1, i32 2, i32 3]
@.str = [12 x i8] c"%d %d %d %d\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @getBit8(i32* %3, i32 2)
%5 = call i32 @getBit8x(i32* %3, i32 1)
%6 = load i32, i32* %3
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %10, i32 %12)
ret i32 0
}