#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 */
int isVarNameRex(char *, int *, int *);
int /*<<< orphan*/ memcpy(char *, char *, int);
int getVarNameRex(char *text, char **nxtAddr, char *var) {
  int indStd = 0;
  int long1 = 0;
  int isVar = (isVarNameRex(text, &indStd, &long1) == 1);
  if (isVar == 1) {
    *nxtAddr = &(text[indStd + long1]);
    memcpy(var, &(text[indStd]), long1);
    var[long1] = '\0';
  } else {
  }
  return isVar;
}


x86 assembly (clang, -O0):
<getVarNameRex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <isVarNameRex@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    11a9 <getVarNameRex+0x89>
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cltq
add    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11ae <getVarNameRex+0x8e>
jmp    11ae <getVarNameRex+0x8e>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getVarNameRex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <isVarNameRex@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
jne    117f <getVarNameRex+0x5f>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rdx
mov    %rdx,%rcx
add    %rax,%rcx
add    %rbx,%rcx
mov    %rcx,(%r15)
add    %rax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <memcpy@plt>
movslq (%rsp),%rax
movb   $0x0,(%r14,%rax,1)
xor    %eax,%eax
cmp    $0x1,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getVarNameRex(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
%10 = load i8*, i8** %4
%11 = call i32 @isVarNameRex(i8* %10, i32* %7, i32* %8)
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %35
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = add nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %17, i64 %21
%23 = load i8**, i8*** %5
store i8* %22, i8** %23
%24 = load i8*, i8** %6
%25 = load i8*, i8** %4
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i32, i32* %8
%30 = call i32 @memcpy(i8* %24, i8* %28, i32 %29)
%31 = load i8*, i8** %6
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 0, i8* %34
br label %36
35: ; preds = %3
br label %36
36: ; preds = %35, %16
%37 = load i32, i32* %9
ret i32 %37
}

LLVM IR (-O2):
define i32 @getVarNameRex(i8* %0, i8** nocapture writeonly %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%8 = call i32 @isVarNameRex(i8* %0, i32* %4, i32* %5)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %12, %11
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8* %15, i8** %1
%16 = sext i32 %11 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = call i32 @memcpy(i8* %2, i8* %17, i32 %12)
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %2, i64 %20
store i8 0, i8* %21
br label %22
22: ; preds = %3, %10
%23 = zext i1 %9 to i32
ret i32 %23
}