#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*/ pmesg(int, char *, int, char *);
int oph_iob_read_as_numeric_array(const char *bin_array, long long array_length,
                                  void **num_array, unsigned int num_type) {
  if (!bin_array || !array_length) {
    pmesg(1,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/OphidiaBigData/ophidia-io-server/refs/"
          "heads/master/src/common/oph-lib-binary-io.c",
          162, "No data to read");
    return 3;
  }
  switch (num_type) {
  case 5:
    *(long long **)num_array = (long long *)bin_array;
    break;
  case 1:
    *(int **)num_array = (int *)bin_array;
    break;
  case 6:
    *(short **)num_array = (short *)bin_array;
    break;
  case 2:
    *(float **)num_array = (float *)bin_array;
    break;
  case 3:
    *(double **)num_array = (double *)bin_array;
    break;
  case 7:
  case 4:
    *(char **)num_array = (char *)bin_array;
    break;
  default:
    pmesg(1,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/OphidiaBigData/ophidia-io-server/refs/"
          "heads/master/src/common/oph-lib-binary-io.c",
          186, "Numerical type not recognized");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<oph_iob_read_as_numeric_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113d <oph_iob_read_as_numeric_array+0x2d>
cmpq   $0x0,-0x18(%rbp)
jne    1166 <oph_iob_read_as_numeric_array+0x56>
mov    $0x1,%edi
lea    0xed3(%rip),%rsi
mov    $0xa2,%edx
lea    0xf73(%rip),%rcx
call   1030 <pmesg@plt>
movl   $0x3,-0x4(%rbp)
jmp    121f <oph_iob_read_as_numeric_array+0x10f>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x6,%eax
ja     11ef <oph_iob_read_as_numeric_array+0xdf>
mov    -0x30(%rbp),%rax
lea    0xe7a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1218 <oph_iob_read_as_numeric_array+0x108>
mov    $0x1,%edi
lea    0xe21(%rip),%rsi
mov    $0xba,%edx
lea    0xed1(%rip),%rcx
call   1030 <pmesg@plt>
movl   $0x1,-0x4(%rbp)
jmp    121f <oph_iob_read_as_numeric_array+0x10f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oph_iob_read_as_numeric_array>:
push   %rbx
test   %rdi,%rdi
je     113a <oph_iob_read_as_numeric_array+0x2a>
test   %rsi,%rsi
je     113a <oph_iob_read_as_numeric_array+0x2a>
add    $0xffffffff,%ecx
cmp    $0x6,%ecx
ja     1160 <oph_iob_read_as_numeric_array+0x50>
lea    0xed6(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    %rdi,(%rdx)
xor    %ebx,%ebx
jmp    115c <oph_iob_read_as_numeric_array+0x4c>
lea    0xedb(%rip),%rsi
lea    0xf80(%rip),%rcx
mov    $0x1,%edi
mov    $0xa2,%edx
call   1030 <pmesg@plt>
mov    $0x3,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb5(%rip),%rsi
lea    0xf6a(%rip),%rcx
mov    $0x1,%ebx
mov    $0x1,%edi
mov    $0xba,%edx
call   1030 <pmesg@plt>
jmp    115c <oph_iob_read_as_numeric_array+0x4c>

LLVM IR (-O0):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OphidiaBigData/ophidia-io-server/refs/heads/master/src/common/oph-lib-binary-io.c\00"
@.str.1 = [16 x i8] c"No data to read\00"
@.str.2 = [30 x i8] c"Numerical type not recognized\00"
define i32 @oph_iob_read_as_numeric_array(i8* %0, i64 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8**
%9 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8** %2, i8*** %8
store i32 %3, i32* %9
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i64, i64* %7
%14 = icmp ne i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12, %4
%16 = call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 162, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 3, i32* %5
br label %50
17: ; preds = %12
%18 = load i32, i32* %9
switch i32 %18, label %47 [
i32 5, label %19
i32 1, label %24
i32 6, label %29
i32 2, label %34
i32 3, label %39
i32 7, label %44
i32 4, label %44
]
19: ; preds = %17
%20 = load i8*, i8** %6
%21 = bitcast i8* %20 to i64*
%22 = load i8**, i8*** %8
%23 = bitcast i8** %22 to i64**
store i64* %21, i64** %23
br label %49
24: ; preds = %17
%25 = load i8*, i8** %6
%26 = bitcast i8* %25 to i32*
%27 = load i8**, i8*** %8
%28 = bitcast i8** %27 to i32**
store i32* %26, i32** %28
br label %49
29: ; preds = %17
%30 = load i8*, i8** %6
%31 = bitcast i8* %30 to i16*
%32 = load i8**, i8*** %8
%33 = bitcast i8** %32 to i16**
store i16* %31, i16** %33
br label %49
34: ; preds = %17
%35 = load i8*, i8** %6
%36 = bitcast i8* %35 to float*
%37 = load i8**, i8*** %8
%38 = bitcast i8** %37 to float**
store float* %36, float** %38
br label %49
39: ; preds = %17
%40 = load i8*, i8** %6
%41 = bitcast i8* %40 to double*
%42 = load i8**, i8*** %8
%43 = bitcast i8** %42 to double**
store double* %41, double** %43
br label %49
44: ; preds = %17, %17
%45 = load i8*, i8** %6
%46 = load i8**, i8*** %8
store i8* %45, i8** %46
br label %49
47: ; preds = %17
%48 = call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 186, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %50
49: ; preds = %44, %39, %34, %29, %24, %19
store i32 0, i32* %5
br label %50
50: ; preds = %49, %47, %15
%51 = load i32, i32* %5
ret i32 %51
}

LLVM IR (-O2):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OphidiaBigData/ophidia-io-server/refs/heads/master/src/common/oph-lib-binary-io.c\00"
@.str.1 = [16 x i8] c"No data to read\00"
@.str.2 = [30 x i8] c"Numerical type not recognized\00"
define i32 @oph_iob_read_as_numeric_array(i8* %0, i64 %1, i8** nocapture writeonly %2, i32 %3) {
%5 = icmp ne i8* %0, null
%6 = icmp ne i64 %1, 0
%7 = and i1 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 162, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %19
10: ; preds = %4
switch i32 %3, label %17 [
i32 5, label %11
i32 1, label %12
i32 6, label %13
i32 2, label %14
i32 3, label %15
i32 7, label %16
i32 4, label %16
]
11: ; preds = %10
store i8* %0, i8** %2
br label %19
12: ; preds = %10
store i8* %0, i8** %2
br label %19
13: ; preds = %10
store i8* %0, i8** %2
br label %19
14: ; preds = %10
store i8* %0, i8** %2
br label %19
15: ; preds = %10
store i8* %0, i8** %2
br label %19
16: ; preds = %10, %10
store i8* %0, i8** %2
br label %19
17: ; preds = %10
%18 = tail call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 186, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %11, %12, %13, %14, %15, %16, %17, %8
%20 = phi i32 [ 1, %17 ], [ 3, %8 ], [ 0, %16 ], [ 0, %15 ], [ 0, %14 ], [ 0, %13 ], [ 0, %12 ], [ 0, %11 ]
ret i32 %20
}