#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_swap(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int mode_swap(sqlite3 *db, int argc, char *argv[]) {
  if (argc < 3) {
    logprintf(0, "Missing arguments\n\n");
    return -1;
  }
  return sqlite_swap(db, strtol(argv[1], NULL, 10), strtol(argv[2], NULL, 10));
}


x86 assembly (clang, -O0):
<mode_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1167 <mode_swap+0x37>
xor    %edi,%edi
lea    0xeaa(%rip),%rsi
call   1050 <logprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11af <mode_swap+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1040 <sqlite_swap@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_swap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jg     1151 <mode_swap+0x21>
lea    0xec0(%rip),%rsi
xor    %edi,%edi
call   1050 <logprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rdx,%rbx
mov    %rdi,%r14
mov    0x8(%rdx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <sqlite_swap@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Missing arguments\0A\0A\00"
define i32 @mode_swap(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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %23
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 = call i32 @strtol(i8* %16, i32* null, i32 10)
%18 = load i8**, i8*** %7
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strtol(i8* %20, i32* null, i32 10)
%22 = call i32 @sqlite_swap(i32* %13, i32 %17, i32 %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %12, %10
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@.str = [20 x i8] c"Missing arguments\0A\0A\00"
define i32 @mode_swap(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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %15
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strtol(i8* nocapture %9, i32* null, i32 10)
%11 = getelementptr inbounds i8*, i8** %2, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @strtol(i8* nocapture %12, i32* null, i32 10)
%14 = tail call i32 @sqlite_swap(i32* %0, i32 %10, i32 %13)
br label %15
15: ; preds = %7, %5
%16 = phi i32 [ -1, %5 ], [ %14, %7 ]
ret i32 %16
}