#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*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ logprintf(int /*<<< orphan*/, char *);
int sqlite_update_msa(int /*<<< orphan*/ *, char *, char *, char *);
int mode_update(sqlite3 *db, int argc, char **argv) {
  if (argc < 3) {
    logprintf(0, "Missing arguments\n");
    return -1;
  }
  return sqlite_update_msa(db, argv[1], argv[2], (argc > 3) ? argv[3] : NULL);
}


x86 assembly (clang, -O0):
<mode_update>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1157 <mode_update+0x37>
xor    %edi,%edi
lea    0xeba(%rip),%rsi
call   1040 <logprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b5 <mode_update+0x95>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x3,-0x14(%rbp)
jle    1192 <mode_update+0x72>
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    119d <mode_update+0x7d>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    119d <mode_update+0x7d>
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rcx
call   1030 <sqlite_update_msa@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_update>:
push   %rax
cmp    $0x2,%esi
jg     113b <mode_update+0x1b>
lea    0xed3(%rip),%rsi
xor    %edi,%edi
call   1040 <logprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    %rdx,%rax
mov    %esi,%ecx
mov    0x8(%rdx),%rsi
mov    0x10(%rdx),%rdx
cmp    $0x3,%ecx
jne    1155 <mode_update+0x35>
xor    %ecx,%ecx
pop    %rax
jmp    1030 <sqlite_update_msa@plt>
mov    0x18(%rax),%rcx
pop    %rax
jmp    1030 <sqlite_update_msa@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Missing arguments\0A\00"
define i32 @mode_update(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8**
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @logprintf(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %30
12: ; preds = %3
%13 = load i32*, i32** %5
%14 = load i8**, i8*** %7
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %7
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i32, i32* %6
%21 = icmp sgt i32 %20, 3
br i1 %21, label %22, label %26
22: ; preds = %12
%23 = load i8**, i8*** %7
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
br label %27
26: ; preds = %12
br label %27
27: ; preds = %26, %22
%28 = phi i8* [ %25, %22 ], [ null, %26 ]
%29 = call i32 @sqlite_update_msa(i32* %13, i8* %16, i8* %19, i8* %28)
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %10
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [19 x i8] c"Missing arguments\0A\00"
define i32 @mode_update(i32* %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 3
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @logprintf(i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %19
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %2, i64 2
%11 = load i8*, i8** %10
%12 = icmp eq i32 %1, 3
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8*, i8** %2, i64 3
%15 = load i8*, i8** %14
br label %16
16: ; preds = %7, %13
%17 = phi i8* [ %15, %13 ], [ null, %7 ]
%18 = tail call i32 @sqlite_update_msa(i32* %0, i8* %9, i8* %11, i8* %17)
br label %19
19: ; preds = %16, %5
%20 = phi i32 [ -1, %5 ], [ %18, %16 ]
ret i32 %20
}