#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;
char transform_char(char const);
char get_byte(const char i_value) {
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_byte(): 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",
      42, (int)(i_value));
  char result = transform_char(i_value);
  fprintf(
      stderr,
      "[INFO](%s:%d:) "
      "dpi_c.get_byte(): 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",
      44, (int)(result));
  return result;
}


x86 assembly (clang, -O0):
<get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
movsbl -0x1(%rbp),%r8d
lea    0xebd(%rip),%rsi
lea    0xee4(%rip),%rdx
mov    $0x2a,%ecx
call   1040 <fprintf@plt>
movsbl -0x1(%rbp),%edi
call   1030 <transform_char@plt>
mov    %al,-0x2(%rbp)
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
movsbl -0x2(%rbp),%r8d
lea    0xf91(%rip),%rsi
lea    0xeb2(%rip),%rdx
mov    $0x2c,%ecx
call   1040 <fprintf@plt>
movsbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2eb2(%rip),%r15
mov    (%r15),%edi
lea    0xec8(%rip),%rsi
lea    0xeef(%rip),%r14
mov    %r14,%rdx
mov    $0x2a,%ecx
mov    %ebx,%r8d
call   1040 <fprintf@plt>
mov    %ebx,%edi
call   1030 <transform_char@plt>
mov    (%r15),%edi
movsbl %al,%ebx
lea    0xfa3(%rip),%rsi
mov    %r14,%rdx
mov    $0x2c,%ecx
mov    %ebx,%r8d
call   1040 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"[INFO](%s:%d:) dpi_c.get_byte(): 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 = [44 x i8] c"[INFO](%s:%d:) dpi_c.get_byte(): return %d\0A\00"
define signext i8 @get_byte(i8 signext %0) {
%2 = load i32, i32* @stderr
%3 = sext i8 %0 to i32
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 42, i32 %3)
%5 = tail call signext i8 @transform_char(i8 signext %0)
%6 = load i32, i32* @stderr
%7 = sext i8 %5 to i32
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0), i32 44, i32 %7)
ret i8 %5
}