#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 */
typedef int /*<<< orphan*/ MYSQL_STMT;

/* Variables and functions */
int /*<<< orphan*/ MySAR_macro_print_msg(char *, int, int, char *,
                                         char const *);
char const *mysql_stmt_error(int /*<<< orphan*/ *);
scalar_t__ mysql_stmt_prepare(int /*<<< orphan*/ *, char const *,
                              unsigned long);
void MySAR_prepare_stmt(MYSQL_STMT *stmt, const char *stmt_str,
                        unsigned long length) {
  MySAR_macro_print_msg(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/coffnix/mysar-ng/refs/heads/master/bin/"
      "mysar-binary-importer/src/sql.c",
      201, 0x04, "Preparing Statement: %s", stmt_str);
  ;
  if (mysql_stmt_prepare(stmt, stmt_str, length) != 0)
    MySAR_macro_print_msg(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/coffnix/mysar-ng/refs/heads/master/bin/"
        "mysar-binary-importer/src/sql.c",
        204, 0x02, "FATAL: Error while preparing MySQL statement: %s",
        mysql_stmt_error(stmt));
  ;
}


x86 assembly (clang, -O0):
<MySAR_prepare_stmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%r8
lea    0xeb1(%rip),%rdi
mov    $0xc9,%esi
mov    $0x4,%edx
lea    0xf41(%rip),%rcx
call   1050 <MySAR_macro_print_msg@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <mysql_stmt_prepare@plt>
cmp    $0x0,%rax
je     11a9 <MySAR_prepare_stmt+0x79>
mov    -0x8(%rbp),%rdi
call   1040 <mysql_stmt_error@plt>
mov    %rax,%r8
lea    0xe6d(%rip),%rdi
mov    $0xcc,%esi
mov    $0x2,%edx
lea    0xf15(%rip),%rcx
call   1050 <MySAR_macro_print_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MySAR_prepare_stmt>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
lea    0xf55(%rip),%rcx
mov    $0xc9,%esi
mov    $0x4,%edx
mov    %rbx,%r8
call   1050 <MySAR_macro_print_msg@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <mysql_stmt_prepare@plt>
test   %rax,%rax
je     119e <MySAR_prepare_stmt+0x6e>
mov    %r15,%rdi
call   1040 <mysql_stmt_error@plt>
lea    0xe80(%rip),%rdi
lea    0xf32(%rip),%rcx
mov    $0xcc,%esi
mov    $0x2,%edx
mov    %rax,%r8
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <MySAR_macro_print_msg@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/coffnix/mysar-ng/refs/heads/master/bin/mysar-binary-importer/src/sql.c\00"
@.str.1 = [24 x i8] c"Preparing Statement: %s\00"
@.str.2 = [49 x i8] c"FATAL: Error while preparing MySQL statement: %s\00"
define void @MySAR_prepare_stmt(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = call i32 @MySAR_macro_print_msg(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 201, i32 4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32*, i32** %4
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = call i64 @mysql_stmt_prepare(i32* %9, i8* %10, i64 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = call i8* @mysql_stmt_error(i32* %15)
%17 = call i32 @MySAR_macro_print_msg(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 204, i32 2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
@.str = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/coffnix/mysar-ng/refs/heads/master/bin/mysar-binary-importer/src/sql.c\00"
@.str.1 = [24 x i8] c"Preparing Statement: %s\00"
@.str.2 = [49 x i8] c"FATAL: Error while preparing MySQL statement: %s\00"
define void @MySAR_prepare_stmt(i32* %0, i8* %1, i64 %2) {
%4 = tail call i32 @MySAR_macro_print_msg(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 201, i32 4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i64 @mysql_stmt_prepare(i32* %0, i8* %1, i64 %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = tail call i8* @mysql_stmt_error(i32* %0)
%9 = tail call i32 @MySAR_macro_print_msg(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 204, i32 2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %3
ret void
}