#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 uwsgi_dyn_dict {
  int dummy;
};

/* Variables and functions */
char *strchr(char *, char);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ uwsgi_dyn_dict_new(struct uwsgi_dyn_dict **, char *, int,
                                      char *, int /*<<< orphan*/);
int /*<<< orphan*/ uwsgi_exit(int);
int /*<<< orphan*/ uwsgi_log(char *, char *);
void uwsgi_opt_add_dyn_dict(char *opt, char *value, void *dict) {
  char *equal = strchr(value, '=');
  if (!equal) {
    uwsgi_log("invalid dictionary syntax for %s\n", opt);
    uwsgi_exit(1);
  }
  struct uwsgi_dyn_dict **udd = (struct uwsgi_dyn_dict **)dict;
  uwsgi_dyn_dict_new(udd, value, equal - value, equal + 1, strlen(equal + 1));
}


x86 assembly (clang, -O0):
<uwsgi_opt_add_dyn_dict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119b <uwsgi_opt_add_dyn_dict+0x4b>
mov    -0x8(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1060 <uwsgi_log@plt>
mov    $0x1,%edi
call   1070 <uwsgi_exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    %eax,%r8d
call   1050 <uwsgi_dyn_dict_new@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_opt_add_dyn_dict>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsi,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    118f <uwsgi_opt_add_dyn_dict+0x3f>
lea    0xe83(%rip),%rdi
mov    %r12,%rsi
call   1060 <uwsgi_log@plt>
mov    $0x1,%edi
call   1070 <uwsgi_exit@plt>
mov    %ebx,%ebp
sub    %r15d,%ebp
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %eax,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <uwsgi_dyn_dict_new@plt>

LLVM IR (-O0):
%struct.uwsgi_dyn_dict = type { i32 }
@.str = [34 x i8] c"invalid dictionary syntax for %s\0A\00"
define void @uwsgi_opt_add_dyn_dict(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.uwsgi_dyn_dict**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = call i8* @strchr(i8* %9, i8 signext 61)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %17, label %13
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = call i32 @uwsgi_log(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @uwsgi_exit(i32 1)
br label %17
17: ; preds = %13, %3
%18 = load i8*, i8** %6
%19 = bitcast i8* %18 to %struct.uwsgi_dyn_dict**
store %struct.uwsgi_dyn_dict** %19, %struct.uwsgi_dyn_dict*** %8
%20 = load %struct.uwsgi_dyn_dict**, %struct.uwsgi_dyn_dict*** %8
%21 = load i8*, i8** %5
%22 = load i8*, i8** %7
%23 = load i8*, i8** %5
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = load i8*, i8** %7
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8*, i8** %7
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = call i32 @strlen(i8* %31)
%33 = call i32 @uwsgi_dyn_dict_new(%struct.uwsgi_dyn_dict** %20, i8* %21, i32 %27, i8* %29, i32 %32)
ret void
}

LLVM IR (-O2):
%struct.uwsgi_dyn_dict = type { i32 }
@.str = [34 x i8] c"invalid dictionary syntax for %s\0A\00"
define void @uwsgi_opt_add_dyn_dict(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 61)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @uwsgi_log(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @uwsgi_exit(i32 1)
br label %9
9: ; preds = %6, %3
%10 = bitcast i8* %2 to %struct.uwsgi_dyn_dict**
%11 = ptrtoint i8* %4 to i64
%12 = ptrtoint i8* %1 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds i8, i8* %4, i64 1
%16 = tail call i32 @strlen(i8* %15)
%17 = tail call i32 @uwsgi_dyn_dict_new(%struct.uwsgi_dyn_dict** %10, i8* %1, i32 %14, i8* %15, i32 %16)
ret void
}