#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*/ strcpy(char *, char const *);
int strlen(char const *);
void httpServer_getCmdParamVal(char *valOut, const char *cmdParam) {
  int i;
  valOut[0] = '\0';
  for (i = 0; i < strlen(cmdParam); i++) {
    if (cmdParam[i] == '=') {
      i++;
      break;
    }
  }
  strcpy(valOut, &cmdParam[i]);
}


x86 assembly (clang, -O0):
<httpServer_getCmdParamVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1190 <httpServer_getCmdParamVal+0x70>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    117d <httpServer_getCmdParamVal+0x5d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1190 <httpServer_getCmdParamVal+0x70>
jmp    1182 <httpServer_getCmdParamVal+0x62>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <httpServer_getCmdParamVal+0x1e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<httpServer_getCmdParamVal>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
movb   $0x0,(%rdi)
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1164 <httpServer_getCmdParamVal+0x44>
xor    %ebx,%ebx
nop
mov    %rbx,%r12
cmpb   $0x3d,(%r15,%rbx,1)
je     115e <httpServer_getCmdParamVal+0x3e>
lea    0x1(%r12),%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <httpServer_getCmdParamVal+0x20>
add    $0x1,%r12
jmp    1167 <httpServer_getCmdParamVal+0x47>
xor    %r12d,%r12d
add    %r12,%r15
mov    %r14,%rdi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define void @httpServer_getCmdParamVal(i8* %0, i8* %1) {
store i8 0, i8* %0
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %2, %11
%6 = phi i64 [ %10, %11 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 61
%10 = add nuw nsw i64 %6, 1
br i1 %9, label %15, label %11
11: ; preds = %5
%12 = tail call i32 @strlen(i8* %1)
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %10, %13
br i1 %14, label %5, label %15
15: ; preds = %5, %11
%16 = shl i64 %10, 32
%17 = ashr exact i64 %16, 32
br label %18
18: ; preds = %15, %2
%19 = phi i64 [ 0, %2 ], [ %17, %15 ]
%20 = getelementptr inbounds i8, i8* %1, i64 %19
%21 = tail call i32 @strcpy(i8* %0, i8* %20)
ret void
}