#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*/ sqlite3_snprintf(int, char *, char *, char const *,
                                    int /*<<< orphan*/);
scalar_t__ strstr(char const *, char const *);
const char *unused_string(const char *z, const char *zA, const char *zB,
                          char *zBuf) {
  unsigned i = 0;
  if (strstr(z, zA) == 0)
    return zA;
  if (strstr(z, zB) == 0)
    return zB;
  do {
    sqlite3_snprintf(20, zBuf, "(%s%u)", zA, i++);
  } while (strstr(z, zBuf) != 0);
  return zBuf;
}


x86 assembly (clang, -O0):
<unused_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
jne    1163 <unused_string+0x43>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11d1 <unused_string+0xb1>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
jne    1187 <unused_string+0x67>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11d1 <unused_string+0xb1>
jmp    118c <unused_string+0x6c>
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    %r8d,%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x14,%edi
lea    0xe53(%rip),%rdx
call   1030 <sqlite3_snprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
jne    118c <unused_string+0x6c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unused_string>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strstr@plt>
test   %rax,%rax
je     118f <unused_string+0x6f>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     1192 <unused_string+0x72>
xor    %r8d,%r8d
lea    0xea8(%rip),%r12
nopl   0x0(%rax,%rax,1)
lea    0x1(%r8),%ebp
mov    $0x14,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
call   1030 <sqlite3_snprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strstr@plt>
mov    %ebp,%r8d
test   %rax,%rax
jne    1160 <unused_string+0x40>
mov    %rbx,%r12
jmp    1192 <unused_string+0x72>
mov    %r14,%r12
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"(%s%u)\00"
define i8* @unused_string(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 0, i32* %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = call i64 @strstr(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = load i8*, i8** %7
store i8* %16, i8** %5
br label %38
17: ; preds = %4
%18 = load i8*, i8** %6
%19 = load i8*, i8** %8
%20 = call i64 @strstr(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load i8*, i8** %8
store i8* %23, i8** %5
br label %38
24: ; preds = %17
br label %25
25: ; preds = %31, %24
%26 = load i8*, i8** %9
%27 = load i8*, i8** %7
%28 = load i32, i32* %10
%29 = add i32 %28, 1
store i32 %29, i32* %10
%30 = call i32 @sqlite3_snprintf(i32 20, i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %27, i32 %28)
br label %31
31: ; preds = %25
%32 = load i8*, i8** %6
%33 = load i8*, i8** %9
%34 = call i64 @strstr(i8* %32, i8* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %25, label %36
36: ; preds = %31
%37 = load i8*, i8** %9
store i8* %37, i8** %5
br label %38
38: ; preds = %36, %22, %15
%39 = load i8*, i8** %5
ret i8* %39
}

LLVM IR (-O2):
@.str = [7 x i8] c"(%s%u)\00"
define i8* @unused_string(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i64 @strstr(i8* %0, i8* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = tail call i64 @strstr(i8* %0, i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %7, %10
%11 = phi i32 [ %12, %10 ], [ 0, %7 ]
%12 = add i32 %11, 1
%13 = tail call i32 @sqlite3_snprintf(i32 20, i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %11)
%14 = tail call i64 @strstr(i8* %0, i8* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %10
16: ; preds = %10, %7, %4
%17 = phi i8* [ %1, %4 ], [ %2, %7 ], [ %3, %10 ]
ret i8* %17
}