#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__ strcmp(char *, char *);
bool match_extension(char *extension, char **suffix) {
  if (!extension) {
    return false;
  }
  for (; *suffix != NULL; suffix++) {
    if (strcmp(extension, *suffix) == 0) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<match_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <match_extension+0x27>
movl   $0x0,-0x4(%rbp)
jmp    118d <match_extension+0x7d>
jmp    113c <match_extension+0x2c>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1186 <match_extension+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1170 <match_extension+0x60>
movl   $0x1,-0x4(%rbp)
jmp    118d <match_extension+0x7d>
jmp    1175 <match_extension+0x65>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    113c <match_extension+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_extension>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
test   %rdi,%rdi
je     1151 <match_extension+0x41>
mov    %rsi,%rbx
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1151 <match_extension+0x41>
mov    %rdi,%rbp
add    $0x8,%rbx
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114b <match_extension+0x3b>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <match_extension+0x20>
jmp    1151 <match_extension+0x41>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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