#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*/ get_cfg_str(char *, char *);
int /*<<< orphan*/ set_cfg_str(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int cfg_set_and_check_str(char *str) {
  char tmp[128] = {0};
  char param[128] = {0};
  int i = 0;
  while ('=' != str[i]) {
    param[i] = str[i];
    i++;
  }
  set_cfg_str(str);
  get_cfg_str(param, tmp);
  if (!strcmp(tmp, str + strlen(param) + 1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<cfg_set_and_check_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x3d,%eax
cmp    %ecx,%eax
je     11db <cfg_set_and_check_str+0x8b>
mov    -0x10(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x114(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    118f <cfg_set_and_check_str+0x3f>
mov    -0x10(%rbp),%rdi
call   1030 <set_cfg_str@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1070 <get_cfg_str@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x128(%rbp)
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x128(%rbp),%rsi
mov    -0x120(%rbp),%rdi
cltq
add    %rax,%rsi
add    $0x1,%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    124d <cfg_set_and_check_str+0xfd>
movl   $0x1,-0x4(%rbp)
jmp    1254 <cfg_set_and_check_str+0x104>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfg_set_and_check_str>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    (%rdi),%al
cmp    $0x3d,%al
je     11e0 <cfg_set_and_check_str+0xa0>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsp,%rcx,1)
movzbl 0x1(%rbx,%rcx,1),%eax
add    $0x1,%rcx
cmp    $0x3d,%al
jne    11d0 <cfg_set_and_check_str+0x90>
mov    %rbx,%rdi
call   1030 <set_cfg_str@plt>
mov    %rsp,%r14
lea    0x80(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <get_cfg_str@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cfg_set_and_check_str(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = alloca i32
store i8* %0, i8** %3
%7 = bitcast [128 x i8]* %4 to i8*
%8 = bitcast [128 x i8]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %17, %1
%10 = load i8*, i8** %3
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 61, %15
br i1 %16, label %17, label %28
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 %24
store i8 %22, i8* %25
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %9
28: ; preds = %9
%29 = load i8*, i8** %3
%30 = call i32 @set_cfg_str(i8* %29)
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%33 = call i32 @get_cfg_str(i8* %31, i8* %32)
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%35 = load i8*, i8** %3
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
%40 = getelementptr inbounds i8, i8* %39, i64 1
%41 = call i32 @strcmp(i8* %34, i8* %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %28
store i32 1, i32* %2
br label %45
44: ; preds = %28
store i32 0, i32* %2
br label %45
45: ; preds = %44, %43
%46 = load i32, i32* %2
ret i32 %46
}

LLVM IR (-O2):
define i32 @cfg_set_and_check_str(i8* %0) {
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 61
br i1 %7, label %16, label %8
8: ; preds = %1, %8
%9 = phi i64 [ %12, %8 ], [ 0, %1 ]
%10 = phi i8 [ %14, %8 ], [ %6, %1 ]
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %9
store i8 %10, i8* %11
%12 = add nuw nsw i64 %9, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 61
br i1 %15, label %16, label %8
16: ; preds = %8, %1
%17 = tail call i32 @set_cfg_str(i8* %0)
%18 = call i32 @get_cfg_str(i8* %5, i8* %4)
%19 = call i32 @strlen(i8* %5)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i32 @strcmp(i8* %4, i8* %22)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
ret i32 %25
}