#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 */
long num_strmatch(char *, char **, long, long);
scalar_t__ strcmp(char *, char *);
long find_1st_atom(char *str, char **strmat, long nb, long ne, char *idmsg) {
  long i, num;
  num = num_strmatch(str, strmat, nb, ne);
  if (!num) {
    return 0;
  }
  if (num > 1 && strcmp(idmsg, "")) {
  }
  for (i = nb; i <= ne; i++)
    if (!strcmp(str, strmat[i]))
      break;
  return i;
}


x86 assembly (clang, -O0):
<find_1st_atom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <num_strmatch@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    116d <find_1st_atom+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    11ef <find_1st_atom+0xcf>
cmpq   $0x1,-0x40(%rbp)
jle    1197 <find_1st_atom+0x77>
mov    -0x30(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1197 <find_1st_atom+0x77>
jmp    1197 <find_1st_atom+0x77>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     11e7 <find_1st_atom+0xc7>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d1 <find_1st_atom+0xb1>
jmp    11e7 <find_1st_atom+0xc7>
jmp    11d6 <find_1st_atom+0xb6>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    119f <find_1st_atom+0x7f>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_1st_atom>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
call   1030 <num_strmatch@plt>
test   %rax,%rax
je     117f <find_1st_atom+0x5f>
cmp    $0x2,%rax
jl     1157 <find_1st_atom+0x37>
lea    0xeb1(%rip),%rsi
mov    %r13,%rdi
call   1040 <strcmp@plt>
cmp    %r14,%rbx
jg     1181 <find_1st_atom+0x61>
add    $0x1,%r14
mov    (%r15,%rbx,8),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1181 <find_1st_atom+0x61>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1160 <find_1st_atom+0x40>
mov    %r14,%rbx
jmp    1181 <find_1st_atom+0x61>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i64 @find_1st_atom(i8* %0, i8** %1, i64 %2, i64 %3, i8* %4) {
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8**
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
store i8* %0, i8** %7
store i8** %1, i8*** %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i8* %4, i8** %11
%14 = load i8*, i8** %7
%15 = load i8**, i8*** %8
%16 = load i64, i64* %9
%17 = load i64, i64* %10
%18 = call i64 @num_strmatch(i8* %14, i8** %15, i64 %16, i64 %17)
store i64 %18, i64* %13
%19 = load i64, i64* %13
%20 = icmp ne i64 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %5
store i64 0, i64* %6
br label %51
22: ; preds = %5
%23 = load i64, i64* %13
%24 = icmp sgt i64 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i8*, i8** %11
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
br label %30
30: ; preds = %29, %25, %22
%31 = load i64, i64* %9
store i64 %31, i64* %12
br label %32
32: ; preds = %46, %30
%33 = load i64, i64* %12
%34 = load i64, i64* %10
%35 = icmp sle i64 %33, %34
br i1 %35, label %36, label %49
36: ; preds = %32
%37 = load i8*, i8** %7
%38 = load i8**, i8*** %8
%39 = load i64, i64* %12
%40 = getelementptr inbounds i8*, i8** %38, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %37, i8* %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %36
br label %49
45: ; preds = %36
br label %46
46: ; preds = %45
%47 = load i64, i64* %12
%48 = add nsw i64 %47, 1
store i64 %48, i64* %12
br label %32
49: ; preds = %44, %32
%50 = load i64, i64* %12
store i64 %50, i64* %6
br label %51
51: ; preds = %49, %21
%52 = load i64, i64* %6
ret i64 %52
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i64 @find_1st_atom(i8* %0, i8** %1, i64 %2, i64 %3, i8* %4) {
%6 = tail call i64 @num_strmatch(i8* %0, i8** %1, i64 %2, i64 %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %25, label %8
8: ; preds = %5
%9 = icmp sgt i64 %6, 1
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = icmp sgt i64 %2, %3
br i1 %13, label %25, label %14
14: ; preds = %12
%15 = add i64 %3, 1
br label %16
16: ; preds = %14, %22
%17 = phi i64 [ %23, %22 ], [ %2, %14 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %0, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = add i64 %17, 1
%24 = icmp eq i64 %17, %3
br i1 %24, label %25, label %16
25: ; preds = %16, %22, %12, %5
%26 = phi i64 [ 0, %5 ], [ %2, %12 ], [ %17, %16 ], [ %15, %22 ]
ret i64 %26
}