#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;
int transform_int(int const);
void compute_int(const int i_value, int *result) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.compute_int(): received %d"
      "\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",
      62, (int)(i_value));
  *result = transform_int(i_value);
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.compute_int(): return %d"
      "\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",
      64, (int)(*result));
}


x86 assembly (clang, -O0):
<compute_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%r8d
lea    0xebd(%rip),%rsi
lea    0xee7(%rip),%rdx
mov    $0x3e,%ecx
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <transform_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%r8d
lea    0xf8e(%rip),%rsi
lea    0xeaf(%rip),%rdx
mov    $0x40,%ecx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_int>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2ead(%rip),%r15
mov    (%r15),%edi
lea    0xec3(%rip),%rsi
lea    0xeed(%rip),%r14
mov    %r14,%rdx
mov    $0x3e,%ecx
mov    %ebp,%r8d
call   1030 <fprintf@plt>
mov    %ebp,%edi
call   1040 <transform_int@plt>
mov    %eax,(%rbx)
mov    (%r15),%edi
lea    0xfa2(%rip),%rsi
mov    %r14,%rdx
mov    $0x40,%ecx
mov    %eax,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

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

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