#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*/ assert(int);
scalar_t__ strcmp(char const *, char const *);
const char *get_mime_by_ext(const char *ext, const char *exts[],
                            const char *mimes[]) {
  int i = 0;
  const char *tmp = NULL;
  assert(ext != NULL && exts != NULL);
  while ((tmp = exts[i]) != NULL) {
    if (strcmp(ext, tmp) == 0) {
      return (mimes[i]);
    }
    i++;
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<get_mime_by_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x31(%rbp)
je     115e <get_mime_by_ext+0x3e>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     11bf <get_mime_by_ext+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b1 <get_mime_by_ext+0x91>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    11c7 <get_mime_by_ext+0xa7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116b <get_mime_by_ext+0x4b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mime_by_ext>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%r15
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
mov    0x0(%r13),%rsi
xor    %r12d,%r12d
test   %rsi,%rsi
je     1183 <get_mime_by_ext+0x63>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     117d <get_mime_by_ext+0x5d>
mov    0x8(%r13,%rbx,8),%rsi
add    $0x1,%rbx
test   %rsi,%rsi
jne    1160 <get_mime_by_ext+0x40>
jmp    1183 <get_mime_by_ext+0x63>
mov    %ebx,%eax
mov    (%r14,%rax,8),%r12
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @get_mime_by_ext(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i8* null, i8** %9
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8**, i8*** %6
%14 = icmp ne i8** %13, null
br label %15
15: ; preds = %12, %3
%16 = phi i1 [ false, %3 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
br label %19
19: ; preds = %37, %15
%20 = load i8**, i8*** %6
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
store i8* %24, i8** %9
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %40
26: ; preds = %19
%27 = load i8*, i8** %5
%28 = load i8*, i8** %9
%29 = call i64 @strcmp(i8* %27, i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i8**, i8*** %7
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
store i8* %36, i8** %4
br label %41
37: ; preds = %26
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %19
40: ; preds = %19
store i8* null, i8** %4
br label %41
41: ; preds = %40, %31
%42 = load i8*, i8** %4
ret i8* %42
}

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