#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*/ die(char *, char *);
char *sdup(char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ verify_document_root(char const *);
void set_option(char **options, const char *name, const char *value) {
  int i;
  if (!strcmp(name, "document_root") || !(strcmp(name, "r"))) {
    verify_document_root(value);
  }
  for (i = 0; i < 40 - 3; i++) {
    if (options[i] == NULL) {
      options[i] = sdup(name);
      options[i + 1] = sdup(value);
      options[i + 2] = NULL;
      break;
    }
  }
  if (i == 40 - 3) {
    die("%s", "Too many options specified");
  }
}


x86 assembly (clang, -O0):
<set_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1186 <set_option+0x46>
mov    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118f <set_option+0x4f>
mov    -0x18(%rbp),%rdi
call   1050 <verify_document_root@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x25,-0x1c(%rbp)
jge    1215 <set_option+0xd5>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1202 <set_option+0xc2>
mov    -0x10(%rbp),%rdi
call   1030 <sdup@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rdi
call   1030 <sdup@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1215 <set_option+0xd5>
jmp    1207 <set_option+0xc7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1196 <set_option+0x56>
cmpl   $0x25,-0x1c(%rbp)
jne    1232 <set_option+0xf2>
lea    0xdea(%rip),%rdi
lea    0xde6(%rip),%rsi
call   1060 <die@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_option>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xea7(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1178 <set_option+0x38>
lea    0xea2(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1180 <set_option+0x40>
mov    %r14,%rdi
call   1050 <verify_document_root@plt>
mov    $0x3,%ebx
cmpq   $0x0,-0x18(%r12,%rbx,8)
je     11b9 <set_option+0x79>
nopl   (%rax)
cmp    $0x27,%rbx
je     11bf <set_option+0x7f>
cmpq   $0x0,-0x10(%r12,%rbx,8)
je     11db <set_option+0x9b>
cmpq   $0x0,-0x8(%r12,%rbx,8)
je     11e1 <set_option+0xa1>
cmpq   $0x0,(%r12,%rbx,8)
je     11e5 <set_option+0xa5>
add    $0x4,%rbx
cmpq   $0x0,-0x18(%r12,%rbx,8)
jne    1190 <set_option+0x50>
add    $0xfffffffffffffffd,%rbx
jmp    11e5 <set_option+0xa5>
lea    0xe4a(%rip),%rdi
lea    0xe46(%rip),%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1060 <die@plt>
add    $0xfffffffffffffffe,%rbx
jmp    11e5 <set_option+0xa5>
add    $0xffffffffffffffff,%rbx
mov    %ebx,%r13d
mov    %r15,%rdi
call   1030 <sdup@plt>
mov    %rax,(%r12,%r13,8)
mov    %r14,%rdi
call   1030 <sdup@plt>
lea    0x1(%rbx),%ecx
mov    %rax,(%r12,%rcx,8)
add    $0x2,%ebx
movq   $0x0,(%r12,%rbx,8)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"document_root\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"Too many options specified\00"
define void @set_option(i8** %0, i8* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11, %3
%16 = load i8*, i8** %6
%17 = call i32 @verify_document_root(i8* %16)
br label %18
18: ; preds = %15, %11
store i32 0, i32* %7
br label %19
19: ; preds = %49, %18
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 37
br i1 %21, label %22, label %52
22: ; preds = %19
%23 = load i8**, i8*** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %48
29: ; preds = %22
%30 = load i8*, i8** %5
%31 = call i8* @sdup(i8* %30)
%32 = load i8**, i8*** %4
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
store i8* %31, i8** %35
%36 = load i8*, i8** %6
%37 = call i8* @sdup(i8* %36)
%38 = load i8**, i8*** %4
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %38, i64 %41
store i8* %37, i8** %42
%43 = load i8**, i8*** %4
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %43, i64 %46
store i8* null, i8** %47
br label %52
48: ; preds = %22
br label %49
49: ; preds = %48
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %19
52: ; preds = %29, %19
%53 = load i32, i32* %7
%54 = icmp eq i32 %53, 37
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @die(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %55, %52
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"document_root\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"Too many options specified\00"
define void @set_option(i8** nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6, %3
%10 = tail call i32 @verify_document_root(i8* %2)
br label %11
11: ; preds = %9, %6
br label %12
12: ; preds = %46, %11
%13 = phi i64 [ 0, %11 ], [ %47, %46 ]
%14 = getelementptr inbounds i8*, i8** %0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %29
17: ; preds = %41, %36, %32, %12
%18 = phi i64 [ %13, %12 ], [ %30, %32 ], [ %37, %36 ], [ %42, %41 ]
%19 = and i64 %18, 4294967295
%20 = getelementptr inbounds i8*, i8** %0, i64 %19
%21 = tail call i8* @sdup(i8* %1)
store i8* %21, i8** %20
%22 = tail call i8* @sdup(i8* %2)
%23 = add nuw i64 %18, 1
%24 = and i64 %23, 4294967295
%25 = getelementptr inbounds i8*, i8** %0, i64 %24
store i8* %22, i8** %25
%26 = add nuw i64 %18, 2
%27 = and i64 %26, 4294967295
%28 = getelementptr inbounds i8*, i8** %0, i64 %27
store i8* null, i8** %28
br label %50
29: ; preds = %12
%30 = or i64 %13, 1
%31 = icmp eq i64 %30, 37
br i1 %31, label %48, label %32
32: ; preds = %29
%33 = getelementptr inbounds i8*, i8** %0, i64 %30
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %17, label %36
36: ; preds = %32
%37 = or i64 %13, 2
%38 = getelementptr inbounds i8*, i8** %0, i64 %37
%39 = load i8*, i8** %38
%40 = icmp eq i8* %39, null
br i1 %40, label %17, label %41
41: ; preds = %36
%42 = or i64 %13, 3
%43 = getelementptr inbounds i8*, i8** %0, i64 %42
%44 = load i8*, i8** %43
%45 = icmp eq i8* %44, null
br i1 %45, label %17, label %46
46: ; preds = %41
%47 = add nuw nsw i64 %13, 4
br label %12
48: ; preds = %29
%49 = tail call i32 @die(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %17, %48
ret void
}