#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*/ add_exported_option_do(int /*<<< orphan*/, char *,
                                          int /*<<< orphan*/, int);
char *strchr(char *, char);
int /*<<< orphan*/ uwsgi_concat2(char *, char *);
int /*<<< orphan*/ uwsgi_exit(int);
int /*<<< orphan*/ uwsgi_log(char *);
void uwsgi_opt_set_placeholder(char *opt, char *value, void *ph) {
  char *p = strchr(value, '=');
  if (!p) {
    uwsgi_log("invalid placeholder/--set value\n");
    uwsgi_exit(1);
  }
  p[0] = 0;
  add_exported_option_do(uwsgi_concat2(value, (char *)""), p + 1, 0,
                         ph ? 1 : 0);
  p[0] = '=';
}


x86 assembly (clang, -O0):
<uwsgi_opt_set_placeholder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    1197 <uwsgi_opt_set_placeholder+0x47>
lea    0xe78(%rip),%rdi
call   1050 <uwsgi_log@plt>
mov    $0x1,%edi
call   1060 <uwsgi_exit@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1070 <uwsgi_concat2@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%rdx
cmovne %eax,%ecx
xor    %edx,%edx
call   1030 <add_exported_option_do@plt>
mov    -0x20(%rbp),%rax
movb   $0x3d,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uwsgi_opt_set_placeholder>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rsi,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1186 <uwsgi_opt_set_placeholder+0x36>
lea    0xe89(%rip),%rdi
call   1050 <uwsgi_log@plt>
mov    $0x1,%edi
call   1060 <uwsgi_exit@plt>
movb   $0x0,(%rbx)
lea    0xe90(%rip),%rsi
mov    %r15,%rdi
call   1070 <uwsgi_concat2@plt>
mov    %rbx,%rsi
add    $0x1,%rsi
xor    %ecx,%ecx
test   %r14,%r14
setne  %cl
mov    %eax,%edi
xor    %edx,%edx
call   1030 <add_exported_option_do@plt>
movb   $0x3d,(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"invalid placeholder/--set value\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @uwsgi_opt_set_placeholder(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = call i8* @strchr(i8* %8, i8 signext 61)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = call i32 @uwsgi_log(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @uwsgi_exit(i32 1)
br label %15
15: ; preds = %12, %3
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 0, i8* %17
%18 = load i8*, i8** %5
%19 = call i32 @uwsgi_concat2(i8* %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8*, i8** %6
%23 = icmp ne i8* %22, null
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 1, i32 0
%26 = call i32 @add_exported_option_do(i32 %19, i8* %21, i32 0, i32 %25)
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 61, i8* %28
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"invalid placeholder/--set value\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @uwsgi_opt_set_placeholder(i8* nocapture readnone %0, i8* %1, i8* readnone %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 ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @uwsgi_exit(i32 1)
br label %9
9: ; preds = %6, %3
store i8 0, i8* %4
%10 = tail call i32 @uwsgi_concat2(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds i8, i8* %4, i64 1
%12 = icmp ne i8* %2, null
%13 = zext i1 %12 to i32
%14 = tail call i32 @add_exported_option_do(i32 %10, i8* %11, i32 0, i32 %13)
store i8 61, i8* %4
ret void
}