#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*/ index_it(char const, int);
void find(const char *a, int an, const char *b, int bn) {
  int i = 0;
  for (i = 0; i < an; i++)
    index_it(a[i], 1);
  for (i = 0; i < bn; i++)
    index_it(b[i], 2);
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1164 <find+0x54>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    $0x1,%esi
movsbl (%rax,%rcx,1),%edi
call   1030 <index_it@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1134 <find+0x24>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119b <find+0x8b>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    $0x2,%esi
movsbl (%rax,%rcx,1),%edi
call   1030 <index_it@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116b <find+0x5b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%r15
test   %esi,%esi
jle    1148 <find+0x38>
mov    %rdi,%r12
mov    %esi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
movsbl (%r12,%rbp,1),%edi
mov    $0x1,%esi
call   1030 <index_it@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <find+0x20>
test   %r14d,%r14d
jle    1178 <find+0x68>
mov    %r14d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r15,%rbp,1),%edi
mov    $0x2,%esi
call   1030 <index_it@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <find+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @find(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %9
br label %10
10: ; preds = %21, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @index_it(i8 signext %19, i32 1)
br label %21
21: ; preds = %14
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
br label %10
24: ; preds = %10
store i32 0, i32* %9
br label %25
25: ; preds = %36, %24
%26 = load i32, i32* %9
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %25
%30 = load i8*, i8** %7
%31 = load i32, i32* %9
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i32 @index_it(i8 signext %34, i32 2)
br label %36
36: ; preds = %29
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %25
39: ; preds = %25
ret void
}

LLVM IR (-O2):
define void @find(i8* nocapture %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %12
8: ; preds = %12, %4
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %26
10: ; preds = %8
%11 = zext i32 %3 to i64
br label %19
12: ; preds = %6, %12
%13 = phi i64 [ 0, %6 ], [ %17, %12 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = tail call i32 @index_it(i8 signext %15, i32 1)
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %8, label %12
19: ; preds = %10, %19
%20 = phi i64 [ 0, %10 ], [ %24, %19 ]
%21 = getelementptr inbounds i8, i8* %2, i64 %20
%22 = load i8, i8* %21
%23 = tail call i32 @index_it(i8 signext %22, i32 2)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, %11
br i1 %25, label %26, label %19
26: ; preds = %19, %8
ret void
}