#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*/ fprintf(int /*<<< orphan*/, char *, char *, int, int);
int /*<<< orphan*/ stderr;
void call_chandle(const void *i_value, int *o_value) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.call_chandle() %p "
      "\n",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/"
      "amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/"
      "dpi_c_ex.c",
      258, i_value);
  int (*pcp)();
  pcp = i_value;
  *o_value = pcp();
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.call_chandle() returns %0d "
      "\n",
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/"
      "amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/"
      "dpi_c_ex.c",
      262, *o_value);
}


x86 assembly (clang, -O0):
<call_chandle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    %eax,%r8d
lea    0xec9(%rip),%rsi
lea    0xeeb(%rip),%rdx
mov    $0x102,%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   *-0x18(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%r8d
lea    0xf8d(%rip),%rsi
lea    0xeae(%rip),%rdx
mov    $0x106,%ecx
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_chandle>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ebb(%rip),%r12
mov    (%r12),%edi
lea    0xed0(%rip),%rsi
lea    0xef2(%rip),%r15
mov    %r15,%rdx
mov    $0x102,%ecx
mov    %ebx,%r8d
call   1030 <fprintf@plt>
xor    %eax,%eax
call   *%rbx
mov    %eax,(%r14)
mov    (%r12),%edi
lea    0xfa8(%rip),%rsi
mov    %r15,%rdx
mov    $0x106,%ecx
mov    %eax,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"[INFO](%s:%d:) dpi_c.call_chandle() %p \0A\00"
@.str.1 = [216 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/dpi_c_ex.c\00"
@.str.2 = [50 x i8] c"[INFO](%s:%d:) dpi_c.call_chandle() returns %0d \0A\00"
define void @call_chandle(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32 (...)*
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i32
%9 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 258, i32 %8)
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to i32 (...)*
store i32 (...)* %11, i32 (...)** %5
%12 = load i32 (...)*, i32 (...)** %5
%13 = call i32 (...) %12()
%14 = load i32*, i32** %4
store i32 %13, i32* %14
%15 = load i32, i32* @stderr
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 262, i32 %17)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"[INFO](%s:%d:) dpi_c.call_chandle() %p \0A\00"
@.str.1 = [216 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/amiq-consulting/amiq_blog/refs/heads/master/amiq_sv_dpi_c_how_to_map_systemverilog_data_types_to_c_using_dpi_c/src/dpi_c_ex.c\00"
@.str.2 = [50 x i8] c"[INFO](%s:%d:) dpi_c.call_chandle() returns %0d \0A\00"
define void @call_chandle(i8* %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* @stderr
%4 = ptrtoint i8* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 258, i32 %5)
%7 = bitcast i8* %0 to i32 (...)*
%8 = tail call i32 (...) %7()
store i32 %8, i32* %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 262, i32 %8)
ret void
}