#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 */
struct lms_parser_info {
  int dummy;
};
typedef int /*<<< orphan*/ so_path;

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ lms_parser_find(char *, int, char const *);
struct lms_parser_info *lms_parser_info(char *);
struct lms_parser_info *lms_parser_info_find(const char *name) {
  char so_path[PATH_MAX];
  if (!name)
    return NULL;
  if (!lms_parser_find(so_path, sizeof(so_path), name))
    return NULL;
  return lms_parser_info(so_path);
}


x86 assembly (clang, -O0):
<lms_parser_info_find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117b <lms_parser_info_find+0x5b>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    11bf <lms_parser_info_find+0x9f>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1030 <lms_parser_find@plt>
cmp    $0x0,%eax
jne    11ab <lms_parser_info_find+0x8b>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    11bf <lms_parser_info_find+0x9f>
mov    -0x30(%rbp),%rdi
call   1040 <lms_parser_info@plt>
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lms_parser_info_find>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %rdi,%rdi
je     115e <lms_parser_info_find+0x3e>
mov    %rdi,%rdx
mov    %rbx,%rdi
call   1030 <lms_parser_find@plt>
test   %eax,%eax
je     115e <lms_parser_info_find+0x3e>
mov    %rbx,%rdi
call   1040 <lms_parser_info@plt>
jmp    1160 <lms_parser_info_find+0x40>
xor    %eax,%eax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.lms_parser_info = type { i32 }
@PATH_MAX = global i32 0
define %struct.lms_parser_info* @lms_parser_info_find(i8* %0) {
%2 = alloca %struct.lms_parser_info*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %4
%10 = alloca i8, i64 %8
store i64 %8, i64* %5
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %1
store %struct.lms_parser_info* null, %struct.lms_parser_info** %2
store i32 1, i32* %6
br label %22
14: ; preds = %1
%15 = trunc i64 %8 to i32
%16 = load i8*, i8** %3
%17 = call i32 @lms_parser_find(i8* %10, i32 %15, i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %14
store %struct.lms_parser_info* null, %struct.lms_parser_info** %2
store i32 1, i32* %6
br label %22
20: ; preds = %14
%21 = call %struct.lms_parser_info* @lms_parser_info(i8* %10)
store %struct.lms_parser_info* %21, %struct.lms_parser_info** %2
store i32 1, i32* %6
br label %22
22: ; preds = %20, %19, %13
%23 = load i8*, i8** %4
%24 = load %struct.lms_parser_info*, %struct.lms_parser_info** %2
ret %struct.lms_parser_info* %24
}

LLVM IR (-O2):
%struct.lms_parser_info = type { i32 }
@PATH_MAX = global i32 0
define %struct.lms_parser_info* @lms_parser_info_find(i8* %0) {
%2 = load i32, i32* @PATH_MAX
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = icmp eq i8* %0, null
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = call i32 @lms_parser_find(i8* %4, i32 %2, i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call %struct.lms_parser_info* @lms_parser_info(i8* %4)
br label %11
11: ; preds = %6, %1, %9
%12 = phi %struct.lms_parser_info* [ %10, %9 ], [ null, %1 ], [ null, %6 ]
ret %struct.lms_parser_info* %12
}