#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);
int get_int(const int i_value) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_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",
      68, (int)(i_value));
  int result = transform_int(i_value);
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_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",
      70, (int)(result));
  return result;
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%r8d
lea    0xec1(%rip),%rsi
lea    0xee7(%rip),%rdx
mov    $0x44,%ecx
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <transform_int@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%r8d
lea    0xf96(%rip),%rsi
lea    0xeb7(%rip),%rdx
mov    $0x46,%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2eb2(%rip),%r15
mov    (%r15),%edi
lea    0xec8(%rip),%rsi
lea    0xeee(%rip),%r14
mov    %r14,%rdx
mov    $0x44,%ecx
mov    %ebx,%r8d
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <transform_int@plt>
mov    %eax,%ebx
mov    (%r15),%edi
lea    0xfa3(%rip),%rsi
mov    %r14,%rdx
mov    $0x46,%ecx
mov    %eax,%r8d
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"[INFO](%s:%d:) dpi_c.get_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 = [43 x i8] c"[INFO](%s:%d:) dpi_c.get_int(): return %d\0A\00"
define i32 @get_int(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 68, i32 %0)
%4 = tail call i32 @transform_int(i32 %0)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 70, i32 %4)
ret i32 %4
}