#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_copy_in_numeric(const char *bin_val, void *num,
                            unsigned int num_type) {
  if (!bin_val) {
    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",
          52, "No data to copy");
    return 3;
  }
  switch (num_type) {
  case 5:
    *(long long *)num = *(long long *)bin_val;
    break;
  case 1:
    *(int *)num = *(int *)bin_val;
    break;
  case 6:
    *(short *)num = *(short *)bin_val;
    break;
  case 2:
    *(float *)num = *(float *)bin_val;
    break;
  case 3:
    *(double *)num = *(double *)bin_val;
    break;
  case 7:
  case 4:
    *(char *)num = *(char *)bin_val;
    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",
          76, "Numerical type not recognized");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<oph_iob_copy_in_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <oph_iob_copy_in_numeric+0x47>
mov    $0x1,%edi
lea    0xee2(%rip),%rsi
mov    $0x34,%edx
lea    0xf82(%rip),%rcx
call   1030 <pmesg@plt>
movl   $0x3,-0x4(%rbp)
jmp    1222 <oph_iob_copy_in_numeric+0x112>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x6,%eax
ja     11f2 <oph_iob_copy_in_numeric+0xe2>
mov    -0x28(%rbp),%rax
lea    0xe89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    121b <oph_iob_copy_in_numeric+0x10b>
mov    $0x1,%edi
lea    0xe1e(%rip),%rsi
mov    $0x4c,%edx
lea    0xece(%rip),%rcx
call   1030 <pmesg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1222 <oph_iob_copy_in_numeric+0x112>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oph_iob_copy_in_numeric>:
push   %rbx
test   %rdi,%rdi
je     1136 <oph_iob_copy_in_numeric+0x26>
add    $0xffffffff,%edx
cmp    $0x6,%edx
ja     115c <oph_iob_copy_in_numeric+0x4c>
lea    0xedb(%rip),%rax
movslq (%rax,%rdx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    (%rdi),%al
mov    %al,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>
lea    0xedf(%rip),%rsi
lea    0xf84(%rip),%rcx
mov    $0x1,%edi
mov    $0x34,%edx
call   1030 <pmesg@plt>
mov    $0x3,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rsi
lea    0xf6e(%rip),%rcx
mov    $0x1,%ebx
mov    $0x1,%edi
mov    $0x4c,%edx
call   1030 <pmesg@plt>
jmp    1158 <oph_iob_copy_in_numeric+0x48>
mov    (%rdi),%eax
mov    %eax,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>
mov    (%rdi),%rax
mov    %rax,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>
movzwl (%rdi),%eax
mov    %ax,(%rsi)
xor    %ebx,%ebx
jmp    1158 <oph_iob_copy_in_numeric+0x48>

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 copy\00"
@.str.2 = [30 x i8] c"Numerical type not recognized\00"
define i32 @oph_iob_copy_in_numeric(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 3, i32* %4
br label %51
12: ; preds = %3
%13 = load i32, i32* %7
switch i32 %13, label %48 [
i32 5, label %14
i32 1, label %20
i32 6, label %26
i32 2, label %32
i32 3, label %38
i32 7, label %44
i32 4, label %44
]
14: ; preds = %12
%15 = load i8*, i8** %5
%16 = bitcast i8* %15 to i64*
%17 = load i64, i64* %16
%18 = load i8*, i8** %6
%19 = bitcast i8* %18 to i64*
store i64 %17, i64* %19
br label %50
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = bitcast i8* %21 to i32*
%23 = load i32, i32* %22
%24 = load i8*, i8** %6
%25 = bitcast i8* %24 to i32*
store i32 %23, i32* %25
br label %50
26: ; preds = %12
%27 = load i8*, i8** %5
%28 = bitcast i8* %27 to i16*
%29 = load i16, i16* %28
%30 = load i8*, i8** %6
%31 = bitcast i8* %30 to i16*
store i16 %29, i16* %31
br label %50
32: ; preds = %12
%33 = load i8*, i8** %5
%34 = bitcast i8* %33 to float*
%35 = load float, float* %34
%36 = load i8*, i8** %6
%37 = bitcast i8* %36 to float*
store float %35, float* %37
br label %50
38: ; preds = %12
%39 = load i8*, i8** %5
%40 = bitcast i8* %39 to double*
%41 = load double, double* %40
%42 = load i8*, i8** %6
%43 = bitcast i8* %42 to double*
store double %41, double* %43
br label %50
44: ; preds = %12, %12
%45 = load i8*, i8** %5
%46 = load i8, i8* %45
%47 = load i8*, i8** %6
store i8 %46, i8* %47
br label %50
48: ; preds = %12
%49 = call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 76, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %51
50: ; preds = %44, %38, %32, %26, %20, %14
store i32 0, i32* %4
br label %51
51: ; preds = %50, %48, %10
%52 = load i32, i32* %4
ret i32 %52
}

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 copy\00"
@.str.2 = [30 x i8] c"Numerical type not recognized\00"
define i32 @oph_iob_copy_in_numeric(i8* %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 52, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %32
7: ; preds = %3
switch i32 %2, label %30 [
i32 5, label %8
i32 1, label %12
i32 6, label %16
i32 2, label %20
i32 3, label %24
i32 7, label %28
i32 4, label %28
]
8: ; preds = %7
%9 = bitcast i8* %0 to i64*
%10 = load i64, i64* %9
%11 = bitcast i8* %1 to i64*
store i64 %10, i64* %11
br label %32
12: ; preds = %7
%13 = bitcast i8* %0 to i32*
%14 = load i32, i32* %13
%15 = bitcast i8* %1 to i32*
store i32 %14, i32* %15
br label %32
16: ; preds = %7
%17 = bitcast i8* %0 to i16*
%18 = load i16, i16* %17
%19 = bitcast i8* %1 to i16*
store i16 %18, i16* %19
br label %32
20: ; preds = %7
%21 = bitcast i8* %0 to float*
%22 = load float, float* %21
%23 = bitcast i8* %1 to float*
store float %22, float* %23
br label %32
24: ; preds = %7
%25 = bitcast i8* %0 to double*
%26 = load double, double* %25
%27 = bitcast i8* %1 to double*
store double %26, double* %27
br label %32
28: ; preds = %7, %7
%29 = load i8, i8* %0
store i8 %29, i8* %1
br label %32
30: ; preds = %7
%31 = tail call i32 @pmesg(i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 76, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %8, %12, %16, %20, %24, %28, %30, %5
%33 = phi i32 [ 1, %30 ], [ 3, %5 ], [ 0, %28 ], [ 0, %24 ], [ 0, %20 ], [ 0, %16 ], [ 0, %12 ], [ 0, %8 ]
ret i32 %33
}