#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 /*<<< orphan*/ setvar(char *, char *);
char *strchr(char *, char);
void setvareq(char *str) {
  char name[32];
  char *p, *s;
  int i;
  s = str;
  p = name;
  for (i = 0; i < 32 - 1; i++) {
    *p++ = *s++;
    if (*s == '=')
      break;
  }
  *p = '\0';
  p = strchr(str, '=');
  setvar(name, p + 1);
}


x86 assembly (clang, -O0):
<setvareq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x1f,-0x44(%rbp)
jge    1197 <setvareq+0x77>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
mov    (%rax),%cl
mov    -0x38(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x38(%rbp)
mov    %cl,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1184 <setvareq+0x64>
jmp    1197 <setvareq+0x77>
jmp    1189 <setvareq+0x69>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1143 <setvareq+0x23>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    $0x1,%rsi
call   1040 <setvar@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setvareq>:
sub    $0x28,%rsp
mov    (%rdi),%al
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsp,%rcx,1)
movzbl 0x1(%rdi,%rcx,1),%eax
lea    0x1(%rcx),%rdx
cmp    $0x3d,%al
je     1149 <setvareq+0x29>
cmp    $0x1e,%rcx
mov    %rdx,%rcx
jne    1130 <setvareq+0x10>
movb   $0x0,(%rsp,%rdx,1)
mov    $0x3d,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rsi
mov    %rsp,%rdi
call   1040 <setvar@plt>
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define void @setvareq(i8* %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 30
%5 = load i8, i8* %0
br label %6
6: ; preds = %6, %1
%7 = phi i8 [ %5, %1 ], [ %12, %6 ]
%8 = phi i8* [ %0, %1 ], [ %10, %6 ]
%9 = phi i8* [ %3, %1 ], [ %11, %6 ]
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %7, i8* %9
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 61
%14 = icmp eq i8* %9, %4
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %6
16: ; preds = %6
store i8 0, i8* %11
%17 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = call i32 @setvar(i8* %3, i8* %18)
ret void
}