#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__ m_next(int, int *, int **);
scalar_t__ mls(int, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char const *);
int v_find_key(int vs, const char *name) {
  char *s;
  int p, *d;
  for (p = -1; m_next(vs, &p, &d);) {
    s = (*(char **)mls((*d), (0)));
    if (strcmp(s, name) == 0)
      return p;
  }
  return -1;
}


x86 assembly (clang, -O0):
<v_find_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x1c(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <m_next@plt>
cmp    $0x0,%rax
je     119b <v_find_key+0x6b>
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <mls@plt>
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1196 <v_find_key+0x66>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <v_find_key+0x72>
jmp    1146 <v_find_key+0x16>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_find_key>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0xffffffff,0xc(%rsp)
ff
lea    0xc(%rsp),%r14
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <m_next@plt>
test   %rax,%rax
je     1196 <v_find_key+0x66>
mov    0x10(%rsp),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <mls@plt>
mov    (%rax),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1160 <v_find_key+0x30>
mov    0xc(%rsp),%eax
jmp    119b <v_find_key+0x6b>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @v_find_key(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32** %4 to i8*
store i32 -1, i32* %3
br label %7
7: ; preds = %10, %2
%8 = call i64 @m_next(i32 %0, i32* %3, i32** %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = call i64 @mls(i32 %12, i32 0)
%14 = inttoptr i64 %13 to i8**
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %10
%19 = load i32, i32* %3
br label %20
20: ; preds = %7, %18
%21 = phi i32 [ %19, %18 ], [ -1, %7 ]
ret i32 %21
}