#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 scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ executeSql(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, char *, int, int, ...);
void addDbRow(time_t ts, int dr, char *ad, int dl, int ul, char *hs) {
  char sql[200];
  if (hs != NULL) {
    sprintf(sql,
            "INSERT INTO data (ts, dr, ad, dl, ul, hs) values (%d, %d, '%s', "
            "%d, %d, '%s')",
            (int)ts, dr, ad, dl, ul, hs);
  } else {
    sprintf(
        sql,
        "INSERT INTO data (ts, dr, ad, dl, ul) values (%d, %d, '%s', %d, %d)",
        (int)ts, dr, ad, dl, ul);
  }
  executeSql(sql, NULL);
}


x86 assembly (clang, -O0):
<addDbRow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1188 <addDbRow+0x68>
lea    -0xf0(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%r10d
mov    -0x28(%rbp),%rax
lea    0xe8d(%rip),%rsi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11b4 <addDbRow+0x94>
lea    -0xf0(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    %eax,%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xea4(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <executeSql@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addDbRow>:
sub    $0xc8,%rsp
mov    %r9,%r11
mov    %r8d,%r10d
mov    %ecx,%r9d
mov    %rdx,%r8
mov    %esi,%ecx
mov    %rdi,%rdx
test   %r11,%r11
je     114d <addDbRow+0x2d>
lea    0xebc(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
push   %r11
jmp    115f <addDbRow+0x3f>
sub    $0x8,%rsp
lea    0xef6(%rip),%rsi
lea    0x8(%rsp),%rdi
xor    %eax,%eax
push   %r10
call   1040 <sprintf@plt>
add    $0x10,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <executeSql@plt>
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [78 x i8] c"INSERT INTO data (ts, dr, ad, dl, ul, hs) values (%d, %d, '%s', %d, %d, '%s')\00"
@.str.1 = [68 x i8] c"INSERT INTO data (ts, dr, ad, dl, ul) values (%d, %d, '%s', %d, %d)\00"
define void @addDbRow(i64 %0, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [200 x i8]
store i64 %0, i64* %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%14 = load i8*, i8** %12
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %26
16: ; preds = %6
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%18 = load i64, i64* %7
%19 = trunc i64 %18 to i32
%20 = load i32, i32* %8
%21 = load i8*, i8** %9
%22 = load i32, i32* %10
%23 = load i32, i32* %11
%24 = load i8*, i8** %12
%25 = call i32 (i8*, i8*, i32, i32, i8*, i32, i32, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i8* %21, i32 %22, i32 %23, i8* %24)
br label %35
26: ; preds = %6
%27 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%28 = load i64, i64* %7
%29 = trunc i64 %28 to i32
%30 = load i32, i32* %8
%31 = load i8*, i8** %9
%32 = load i32, i32* %10
%33 = load i32, i32* %11
%34 = call i32 (i8*, i8*, i32, i32, i8*, i32, i32, ...) @sprintf(i8* %27, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %30, i8* %31, i32 %32, i32 %33)
br label %35
35: ; preds = %26, %16
%36 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 0, i64 0
%37 = call i32 @executeSql(i8* %36, i32* null)
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"INSERT INTO data (ts, dr, ad, dl, ul, hs) values (%d, %d, '%s', %d, %d, '%s')\00"
@.str.1 = [68 x i8] c"INSERT INTO data (ts, dr, ad, dl, ul) values (%d, %d, '%s', %d, %d)\00"
define void @addDbRow(i64 %0, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca [200 x i8]
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%9 = icmp eq i8* %5, null
%10 = trunc i64 %0 to i32
br i1 %9, label %13, label %11
11: ; preds = %6
%12 = call i32 (i8*, i8*, i32, i32, i8*, i32, i32, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %1, i8* %2, i32 %3, i32 %4, i8* %5)
br label %15
13: ; preds = %6
%14 = call i32 (i8*, i8*, i32, i32, i8*, i32, i32, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %1, i8* %2, i32 %3, i32 %4)
br label %15
15: ; preds = %13, %11
%16 = call i32 @executeSql(i8* %8, i32* null)
ret void
}