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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int libinjection_sqli(char const *, size_t, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
size_t strlen(char const *);
int main(int argc, const char *argv[]) {
  char fingerprint[8];
  const char *input;
  size_t slen;
  int issqli;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s inputstring\n", argv[0]);
    return -1;
  }
  input = argv[1];
  slen = strlen(input);
  issqli = libinjection_sqli(input, slen, fingerprint);
  if (issqli) {
    printf("sqli with fingerprint of '%s'\n", fingerprint);
  } else {
    printf("not sqli\n");
  }
  return issqli;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ea <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <libinjection_sqli@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11d6 <main+0x96>
lea    -0x18(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e4 <main+0xa4>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jg     1179 <main+0x29>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe93(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    11be <main+0x6e>
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1070 <libinjection_sqli@plt>
test   %eax,%eax
je     11b0 <main+0x60>
mov    %eax,%ebx
lea    0xe75(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11be <main+0x6e>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: %s inputstring\0A\00"
@.str.1 = [31 x i8] c"sqli with fingerprint of '%s'\0A\00"
@.str.2 = [10 x i8] c"not sqli\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8 x i8]
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 -1, i32* %3
br label %37
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i64 @strlen(i8* %22)
store i64 %23, i64* %8
%24 = load i8*, i8** %7
%25 = load i64, i64* %8
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%27 = call i32 @libinjection_sqli(i8* %24, i64 %25, i8* %26)
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %18
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %35
33: ; preds = %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = load i32, i32* %9
store i32 %36, i32* %3
br label %37
37: ; preds = %35, %12
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: %s inputstring\0A\00"
@.str.1 = [31 x i8] c"sqli with fingerprint of '%s'\0A\00"
@str = [9 x i8] c"not sqli\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %20
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strlen(i8* dereferenceable(1) %12)
%14 = call i32 @libinjection_sqli(i8* %12, i64 %13, i8* %4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %20
18: ; preds = %10
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %16, %18, %6
%21 = phi i32 [ -1, %6 ], [ 0, %18 ], [ %14, %16 ]
ret i32 %21
}