#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 */
scalar_t__ SC_Compare(int /*<<< orphan*/);
int SC_MatchString(char **strings) {
  int i;
  for (i = 0; *strings != NULL; i++) {
    if (SC_Compare(*strings++)) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<SC_MatchString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1172 <SC_MatchString+0x62>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <SC_Compare@plt>
cmp    $0x0,%rax
je     115f <SC_MatchString+0x4f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <SC_MatchString+0x69>
jmp    1164 <SC_MatchString+0x54>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <SC_MatchString+0x13>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SC_MatchString>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    $0xffffffff,%r14d
test   %rdi,%rdi
je     114d <SC_MatchString+0x3d>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
call   1030 <SC_Compare@plt>
test   %rax,%rax
jne    114a <SC_MatchString+0x3a>
mov    0x8(%rbx,%rbp,8),%rdi
add    $0x1,%rbp
test   %rdi,%rdi
jne    1130 <SC_MatchString+0x20>
jmp    114d <SC_MatchString+0x3d>
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SC_MatchString(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i32 1
store i8** %11, i8*** %3
%12 = load i8*, i8** %10
%13 = ptrtoint i8* %12 to i32
%14 = call i64 @SC_Compare(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %23
18: ; preds = %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i32 -1, i32* %2
br label %23
23: ; preds = %22, %16
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @SC_MatchString(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %17, label %4
4: ; preds = %1, %12
%5 = phi i8* [ %15, %12 ], [ %2, %1 ]
%6 = phi i32 [ %14, %12 ], [ 0, %1 ]
%7 = phi i8** [ %13, %12 ], [ %0, %1 ]
%8 = ptrtoint i8* %5 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i64 @SC_Compare(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = getelementptr inbounds i8*, i8** %7, i64 1
%14 = add nuw nsw i32 %6, 1
%15 = load i8*, i8** %13
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %4
17: ; preds = %4, %12, %1
%18 = phi i32 [ -1, %1 ], [ -1, %12 ], [ %6, %4 ]
ret i32 %18
}