#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,
                           char const *);
int /*<<< orphan*/ stderr;
char *get_string(const char *i_value) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_string(): received %s"
      "\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",
      107, i_value);
  char *result = "DEAF_BEAF_DRINKS_COFFEE";
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_string(): return %s"
      "\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",
      109, result);
  return result;
}


x86 assembly (clang, -O0):
<get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%r8
lea    0xed0(%rip),%rsi
lea    0xef9(%rip),%rdx
mov    $0x6b,%ecx
call   1030 <fprintf@plt>
lea    0xfc0(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%r8
lea    0xfc0(%rip),%rsi
lea    0xec9(%rip),%rdx
mov    $0x6d,%ecx
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r8
mov    0x2ec2(%rip),%rbx
mov    (%rbx),%edi
lea    0xed9(%rip),%rsi
lea    0xf02(%rip),%r14
mov    %r14,%rdx
mov    $0x6b,%ecx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfdc(%rip),%rsi
lea    0xfbd(%rip),%rbx
mov    %r14,%rdx
mov    $0x6d,%ecx
mov    %rbx,%r8
call   1030 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"[INFO](%s:%d:) dpi_c.get_string(): received %s\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 = [24 x i8] c"DEAF_BEAF_DRINKS_COFFEE\00"
@.str.3 = [46 x i8] c"[INFO](%s:%d:) dpi_c.get_string(): return %s\0A\00"
define i8* @get_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %2
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* %5)
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %3
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 109, i8* %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"[INFO](%s:%d:) dpi_c.get_string(): received %s\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 = [24 x i8] c"DEAF_BEAF_DRINKS_COFFEE\00"
@.str.3 = [46 x i8] c"[INFO](%s:%d:) dpi_c.get_string(): return %s\0A\00"
define i8* @get_string(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 109, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0)
}