#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 */
struct sqlConnection {
  int dummy;
};
typedef int /*<<< orphan*/ query;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
char *cloneString(int /*<<< orphan*/);
int /*<<< orphan*/ sqlQuickQuery(struct sqlConnection *, char *, char *, int);
int /*<<< orphan*/ sqlSafef(char *, int, char *, int);
char *bioImageSubmitId(struct sqlConnection *conn, int id) {
  char query[256], buf[256];
  sqlSafef(query, sizeof(query),
           "select submitId from image"
           " where image.id=%d",
           id);
  return cloneString(sqlQuickQuery(conn, query, buf, sizeof(buf)));
}


x86 assembly (clang, -O0):
<bioImageSubmitId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x100,%esi
lea    0xea8(%rip),%rdx
call   1030 <sqlSafef@plt>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x210(%rbp),%rdx
mov    $0x100,%ecx
call   1050 <sqlQuickQuery@plt>
mov    %eax,%edi
call   1040 <cloneString@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bioImageSubmitId>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %esi,%ecx
mov    %rdi,%rbx
lea    0xeba(%rip),%rdx
lea    0x100(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1030 <sqlSafef@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x100,%ecx
call   1050 <sqlQuickQuery@plt>
mov    %eax,%edi
call   1040 <cloneString@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sqlConnection = type { i32 }
@.str = [45 x i8] c"select submitId from image where image.id=%d\00"
define i8* @bioImageSubmitId(%struct.sqlConnection* %0, i32 %1) {
%3 = alloca %struct.sqlConnection*
%4 = alloca i32
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
store %struct.sqlConnection* %0, %struct.sqlConnection** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @sqlSafef(i8* %7, i32 256, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load %struct.sqlConnection*, %struct.sqlConnection** %3
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = call i32 @sqlQuickQuery(%struct.sqlConnection* %10, i8* %11, i8* %12, i32 256)
%14 = call i8* @cloneString(i32 %13)
ret i8* %14
}

LLVM IR (-O2):
%struct.sqlConnection = type { i32 }
@.str = [45 x i8] c"select submitId from image where image.id=%d\00"
define i8* @bioImageSubmitId(%struct.sqlConnection* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = call i32 @sqlSafef(i8* %5, i32 256, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %1)
%8 = call i32 @sqlQuickQuery(%struct.sqlConnection* %0, i8* %5, i8* %6, i32 256)
%9 = call i8* @cloneString(i32 %8)
ret i8* %9
}