#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 *);
int check_name(char *str, char *list, int n, int blen) {
  int i, lf;
  char *lptr;
  lf = 0;
  i = 0;
  while (i < n) {
    lptr = list + i * blen;
    if (strcmp(str, lptr) == 0) {
      lf = 1;
      i = n;
    } else
      i++;
  }
  return (lf);
}


x86 assembly (clang, -O0):
<check_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118c <check_name+0x7c>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    117e <check_name+0x6e>
movl   $0x1,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <check_name+0x77>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <check_name+0x24>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1176 <check_name+0x66>
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1149 <check_name+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,%ebx
mov    %eax,%ebp
cmp    %r13d,%edx
jge    1178 <check_name+0x68>
mov    %ebx,%eax
imul   %r14d,%eax
movslq %eax,%rsi
add    %r15,%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
mov    %r13d,%edx
test   %rcx,%rcx
je     1140 <check_name+0x30>
add    $0x1,%ebx
mov    %ebp,%eax
mov    %ebx,%edx
jmp    1140 <check_name+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @check_name(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %18
6: ; preds = %4, %6
%7 = phi i32 [ %16, %6 ], [ 0, %4 ]
%8 = phi i32 [ %15, %6 ], [ 0, %4 ]
%9 = mul nsw i32 %7, %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = tail call i64 @strcmp(i8* %0, i8* %11)
%13 = icmp eq i64 %12, 0
%14 = add nsw i32 %7, 1
%15 = select i1 %13, i32 1, i32 %8
%16 = select i1 %13, i32 %2, i32 %14
%17 = icmp slt i32 %16, %2
br i1 %17, label %6, label %18
18: ; preds = %6, %4
%19 = phi i32 [ 0, %4 ], [ %15, %6 ]
ret i32 %19
}