#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, long);
int /*<<< orphan*/ stderr;
long transform_long_int(long const);
void compute_longint(const long int i_value, long int *result) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.compute_longint(): received %ld"
      "\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",
      75, (long int)(i_value));
  *result = transform_long_int(i_value);
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.compute_longint(): return %ld"
      "\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",
      77, (long int)(*result));
}


x86 assembly (clang, -O0):
<compute_longint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%r8
lea    0xebc(%rip),%rsi
lea    0xeeb(%rip),%rdx
mov    $0x4b,%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <transform_long_int@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%r8
lea    0xf8f(%rip),%rsi
lea    0xeb0(%rip),%rdx
mov    $0x4d,%ecx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_longint>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eab(%rip),%r12
mov    (%r12),%edi
lea    0xec0(%rip),%rsi
lea    0xeef(%rip),%r15
mov    %r15,%rdx
mov    $0x4b,%ecx
mov    %rbx,%r8
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <transform_long_int@plt>
mov    %rax,(%r14)
mov    (%r12),%edi
lea    0xfa1(%rip),%rsi
mov    %r15,%rdx
mov    $0x4d,%ecx
mov    %rax,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"[INFO](%s:%d:) dpi_c.compute_longint(): received %ld\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 = [52 x i8] c"[INFO](%s:%d:) dpi_c.compute_longint(): return %ld\0A\00"
define void @compute_longint(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
%5 = load i32, i32* @stderr
%6 = load i64, i64* %3
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 75, i64 %6)
%8 = load i64, i64* %3
%9 = call i64 @transform_long_int(i64 %8)
%10 = load i64*, i64** %4
store i64 %9, i64* %10
%11 = load i32, i32* @stderr
%12 = load i64*, i64** %4
%13 = load i64, i64* %12
%14 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 77, i64 %13)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"[INFO](%s:%d:) dpi_c.compute_longint(): received %ld\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 = [52 x i8] c"[INFO](%s:%d:) dpi_c.compute_longint(): return %ld\0A\00"
define void @compute_longint(i64 %0, i64* nocapture writeonly %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 75, i64 %0)
%5 = tail call i64 @transform_long_int(i64 %0)
store i64 %5, i64* %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 77, i64 %5)
ret void
}