#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 strcmparray(char chaine1[100][100], char chaine2[], int *ic) {
  int i, ir;
  char c;
  char rc[1000];
  c = chaine1[0][0];
  i = 0, ir = 0;
  while (c != 0) {
    if (strcmp(chaine1[i], chaine2) == 0) {
      ir = 1;
      break;
    }
    i++;
    c = chaine1[i][0];
  }
  *ic = i;
  return ir;
}


x86 assembly (clang, -O0):
<strcmparray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x0,%eax
je     119b <strcmparray+0x8b>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1179 <strcmparray+0x69>
movl   $0x1,-0x20(%rbp)
jmp    119b <strcmparray+0x8b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
jmp    113e <strcmparray+0x2e>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmparray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
cmpb   $0x0,(%rdi)
je     1150 <strcmparray+0x40>
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1157 <strcmparray+0x47>
add    $0x1,%r12
cmpb   $0x0,0x64(%rbx)
lea    0x64(%rbx),%rbx
jne    1130 <strcmparray+0x20>
jmp    1153 <strcmparray+0x43>
xor    %r12d,%r12d
xor    %eax,%eax
jmp    115c <strcmparray+0x4c>
mov    $0x1,%eax
mov    %r12d,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @strcmparray([100 x i8]* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 0, i64 0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %3, %12
%8 = phi i64 [ %13, %12 ], [ 0, %3 ]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %8, i64 0
%10 = tail call i64 @strcmp(i8* %9, i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %7
%13 = add nuw i64 %8, 1
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %0, i64 %13, i64 0
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %7
17: ; preds = %7, %12
%18 = phi i64 [ %13, %12 ], [ %8, %7 ]
%19 = phi i32 [ 0, %12 ], [ 1, %7 ]
%20 = trunc i64 %18 to i32
br label %21
21: ; preds = %17, %3
%22 = phi i32 [ 0, %3 ], [ %20, %17 ]
%23 = phi i32 [ 0, %3 ], [ %19, %17 ]
store i32 %22, i32* %2
ret i32 %23
}