#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 */
size_t strlen(char const *);
int /*<<< orphan*/ strncmp(char *, char const *, size_t);
char *strcmpenv_(const char *aEnvName, char *aEnv) {
  char *env = 0;
  size_t namelen = strlen(aEnvName);
  if (!strncmp(aEnv, aEnvName, namelen) && '=' == aEnv[namelen])
    env = aEnv + namelen + 1;
  return env;
}


x86 assembly (clang, -O0):
<strcmpenv_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1188 <strcmpenv_+0x68>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x3d,%eax
cmp    %ecx,%eax
jne    1188 <strcmpenv_+0x68>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmpenv_>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1149 <strcmpenv_+0x29>
xor    %eax,%eax
jmp    1159 <strcmpenv_+0x39>
xor    %eax,%eax
cmpb   $0x3d,(%r14,%r15,1)
lea    0x1(%r14,%r15,1),%rcx
cmove  %rcx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strcmpenv_(i8* nocapture %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i32 @strncmp(i8* %1, i8* %0, i64 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %1, i64 %3
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 61
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = select i1 %9, i8* %10, i8* null
br label %12
12: ; preds = %6, %2
%13 = phi i8* [ null, %2 ], [ %11, %6 ]
ret i8* %13
}