#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__ strncmp(char const *, char const *, int);
int wcsutil_all_sval(int nelem, const char *sval, const char (*sarr)[72]) {
  for (int i = 0; i < nelem; i++) {
    if (strncmp(sarr[i], sval, 72))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<wcsutil_all_sval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117c <wcsutil_all_sval+0x6c>
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0x48,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x48,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1169 <wcsutil_all_sval+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1183 <wcsutil_all_sval+0x73>
jmp    116e <wcsutil_all_sval+0x5e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <wcsutil_all_sval+0x1a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsutil_all_sval>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    117f <wcsutil_all_sval+0x6f>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rdx,%rdi
mov    $0x48,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1184 <wcsutil_all_sval+0x74>
mov    %ebp,%r15d
add    $0x48,%rbx
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,%rbp
cmp    %rcx,%r15
je     1175 <wcsutil_all_sval+0x65>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x48,%edx
call   1030 <strncmp@plt>
lea    0x1(%rbp),%rcx
add    $0x48,%rbx
test   %rax,%rax
je     1150 <wcsutil_all_sval+0x40>
xor    %eax,%eax
cmp    %r15,%rbp
setae  %al
jmp    1184 <wcsutil_all_sval+0x74>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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