#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*/ TestGetCharFromArrayEx(char *, int, char *, int, int, int);
int /*<<< orphan*/ printf(char *);
void TestGetCharFromArray() {
  char *dummy = NULL;
  char result = 0;
  char test1[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  char test2[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  char test3[8] = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
  char test4[8] = {0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
  char test5[8] = {0xA1, 0xB0, 0xC1, 0xD0, 0xF1, 0xE0, 0x81, 0x70};
  char test6[8] = {0xf0, 0xf1, 0xf0, 0xf0, 0xf1, 0xf0, 0xf0, 0xf1};
  printf("\n-------------------------------------------------------------------"
         "---------\n");
  printf("  Test GetCharFromArray()\n");
  printf("---------------------------------------------------------------------"
         "-------\n");
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         231, dummy, 8, -1, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         232, test1, 0, -1, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         234, test1, 7, -1, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         235, test1, -8, -1, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         238, test1, 8, 0, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         239, test2, 8, 0, 0xff);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         240, test3, 8, 0, 0xff);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         241, test4, 8, 0, 0x00);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         242, test5, 8, 0, 0xaa);
  TestGetCharFromArrayEx("/scratch/repos/new/home/jordi_armengol_estape/"
                         "c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/"
                         "QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c",
                         243, test6, 8, 0, 0x49);
  printf("---------------------------------------------------------------------"
         "-------\n");
  printf("  Done.\n");
  printf("---------------------------------------------------------------------"
         "-------\n\n");
}


x86 assembly (clang, -O0):
<TestGetCharFromArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    0xea5(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x21(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x29(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x31(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x39(%rbp)
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdx
lea    0xed8(%rip),%rdi
mov    $0xe7,%esi
mov    $0x8,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x11(%rbp),%rdx
lea    0xeb5(%rip),%rdi
mov    $0xe8,%esi
xor    %r9d,%r9d
mov    $0xffffffff,%r8d
mov    %r9d,%ecx
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x11(%rbp),%rdx
lea    0xe94(%rip),%rdi
mov    $0xea,%esi
mov    $0x7,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x11(%rbp),%rdx
lea    0xe71(%rip),%rdi
mov    $0xeb,%esi
mov    $0xfffffff8,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x11(%rbp),%rdx
lea    0xe4e(%rip),%rdi
mov    $0xee,%esi
mov    $0x8,%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x19(%rbp),%rdx
lea    0xe2e(%rip),%rdi
mov    $0xef,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xff,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x21(%rbp),%rdx
lea    0xe0b(%rip),%rdi
mov    $0xf0,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xff,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x29(%rbp),%rdx
lea    0xde8(%rip),%rdi
mov    $0xf1,%esi
mov    $0x8,%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x31(%rbp),%rdx
lea    0xdc8(%rip),%rdi
mov    $0xf2,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xaa,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    -0x39(%rbp),%rdx
lea    0xda5(%rip),%rdi
mov    $0xf3,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0x49,%r9d
call   1050 <TestGetCharFromArrayEx@plt>
lea    0xd1d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestGetCharFromArray>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movq   $0x0,0x28(%rsp)
movq   $0xffffffffffffffff,0x20(%rsp)
ff ff
movabs $0x101010101010101,%rax
01 01 01
mov    %rax,0x18(%rsp)
movabs $0xfefefefefefefefe,%rax
fe fe fe
mov    %rax,0x10(%rsp)
movabs $0x7081e0f1d0c1b0a1,%rax
e0 81 70
mov    %rax,0x8(%rsp)
movabs $0xf1f0f0f1f0f0f1f0,%rax
f0 f0 f1
mov    %rax,(%rsp)
lea    0xf1b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%r15
mov    %r15,%rdi
mov    $0xe7,%esi
xor    %edx,%edx
mov    $0x8,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
lea    0x28(%rsp),%rbx
mov    %r15,%rdi
mov    $0xe8,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
mov    %r15,%rdi
mov    $0xea,%esi
mov    %rbx,%rdx
mov    $0x7,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
mov    %r15,%rdi
mov    $0xeb,%esi
mov    %rbx,%rdx
mov    $0xfffffff8,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
mov    %r15,%rdi
mov    $0xee,%esi
mov    %rbx,%rdx
mov    $0x8,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
lea    0x20(%rsp),%rdx
mov    %r15,%rdi
mov    $0xef,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xff,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
lea    0x18(%rsp),%rdx
mov    %r15,%rdi
mov    $0xf0,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xff,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    $0xf1,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
mov    $0xf2,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0xaa,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
mov    %rsp,%rdx
mov    %r15,%rdi
mov    $0xf3,%esi
mov    $0x8,%ecx
xor    %r8d,%r8d
mov    $0x49,%r9d
call   1040 <TestGetCharFromArrayEx@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1a(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.TestGetCharFromArray.test2 = [8 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF"
@__const.TestGetCharFromArray.test3 = [8 x i8] c"\01\01\01\01\01\01\01\01"
@__const.TestGetCharFromArray.test4 = [8 x i8] c"\FE\FE\FE\FE\FE\FE\FE\FE"
@__const.TestGetCharFromArray.test5 = [8 x i8] c"\A1\B0\C1\D0\F1\E0\81p"
@__const.TestGetCharFromArray.test6 = [8 x i8] c"\F0\F1\F0\F0\F1\F0\F0\F1"
@.str = [79 x i8] c"\0A----------------------------------------------------------------------------\0A\00"
@.str.1 = [27 x i8] c" Test GetCharFromArray()\0A\00"
@.str.2 = [78 x i8] c"----------------------------------------------------------------------------\0A\00"
@.str.3 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c\00"
@.str.4 = [9 x i8] c" Done.\0A\00"
@.str.5 = [79 x i8] c"----------------------------------------------------------------------------\0A\0A\00"
define void @TestGetCharFromArray() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca [8 x i8]
%4 = alloca [8 x i8]
%5 = alloca [8 x i8]
%6 = alloca [8 x i8]
%7 = alloca [8 x i8]
%8 = alloca [8 x i8]
store i8* null, i8** %1
store i8 0, i8* %2
%9 = bitcast [8 x i8]* %3 to i8*
%10 = bitcast [8 x i8]* %4 to i8*
%11 = bitcast [8 x i8]* %5 to i8*
%12 = bitcast [8 x i8]* %6 to i8*
%13 = bitcast [8 x i8]* %7 to i8*
%14 = bitcast [8 x i8]* %8 to i8*
%15 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8*, i8** %1
%19 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 231, i8* %18, i32 8, i32 -1, i32 0)
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%21 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 232, i8* %20, i32 0, i32 -1, i32 0)
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%23 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 234, i8* %22, i32 7, i32 -1, i32 0)
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%25 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 235, i8* %24, i32 -8, i32 -1, i32 0)
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%27 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 238, i8* %26, i32 8, i32 0, i32 0)
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%29 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 239, i8* %28, i32 8, i32 0, i32 255)
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%31 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 240, i8* %30, i32 8, i32 0, i32 255)
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%33 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 241, i8* %32, i32 8, i32 0, i32 0)
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%35 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 242, i8* %34, i32 8, i32 0, i32 170)
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%37 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 243, i8* %36, i32 8, i32 0, i32 73)
%38 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NaMorham/QUT-Tutoring-1-C/refs/heads/master/GetLastBit/main.c\00"
@str = [78 x i8] c"\0A----------------------------------------------------------------------------\00"
@str.6 = [26 x i8] c" Test GetCharFromArray()\00"
@str.8 = [77 x i8] c"----------------------------------------------------------------------------\00"
@str.9 = [8 x i8] c" Done.\00"
@str.10 = [78 x i8] c"----------------------------------------------------------------------------\0A\00"
define void @TestGetCharFromArray() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%8 = bitcast i64* %2 to i8*
store i64 -1, i64* %2
%9 = bitcast i64* %3 to i8*
store i64 72340172838076673, i64* %3
%10 = bitcast i64* %4 to i8*
store i64 -72340172838076674, i64* %4
%11 = bitcast i64* %5 to i8*
store i64 8107008133437698209, i64* %5
%12 = bitcast i64* %6 to i8*
store i64 -1013044994238254608, i64* %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.8, i64 0, i64 0))
%16 = tail call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 231, i8* null, i32 8, i32 -1, i32 0)
%17 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 232, i8* %7, i32 0, i32 -1, i32 0)
%18 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 234, i8* %7, i32 7, i32 -1, i32 0)
%19 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 235, i8* %7, i32 -8, i32 -1, i32 0)
%20 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 238, i8* %7, i32 8, i32 0, i32 0)
%21 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 239, i8* %8, i32 8, i32 0, i32 255)
%22 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 240, i8* %9, i32 8, i32 0, i32 255)
%23 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 241, i8* %10, i32 8, i32 0, i32 0)
%24 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 242, i8* %11, i32 8, i32 0, i32 170)
%25 = call i32 @TestGetCharFromArrayEx(i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 243, i8* %12, i32 8, i32 0, i32 73)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.8, i64 0, i64 0))
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.9, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.10, i64 0, i64 0))
ret void
}