#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 */
char **pygame_scrap_get_types();
scalar_t__ strcmp(char *, char *);
int pygame_scrap_contains(char *type) {
  int i = 0;
  char **types = pygame_scrap_get_types();
  while (types[i]) {
    if (strcmp(type, types[i]) == 0)
      return 1;
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<pygame_scrap_contains>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <pygame_scrap_get_types@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     118a <pygame_scrap_contains+0x6a>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    117c <pygame_scrap_contains+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1191 <pygame_scrap_contains+0x71>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <pygame_scrap_contains+0x1e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pygame_scrap_contains>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <pygame_scrap_get_types@plt>
mov    (%rax),%rsi
test   %rsi,%rsi
je     1162 <pygame_scrap_contains+0x42>
mov    %rax,%rbp
add    $0x8,%rbp
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115c <pygame_scrap_contains+0x3c>
mov    0x0(%rbp),%rsi
add    $0x8,%rbp
test   %rsi,%rsi
jne    1140 <pygame_scrap_contains+0x20>
jmp    1162 <pygame_scrap_contains+0x42>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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