#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*/ parseNameValue(char *, char *);
int strpos(char *, char *);
void parsePostdata(char *formdata) {
  ;
  int pos;
  if ((pos = strpos(formdata, "&")) != -1) {
    formdata[pos] = '\0';
    parsePostdata(formdata);
    parsePostdata(&formdata[pos + 1]);
  } else {
    if ((pos = strpos(formdata, "=")) != -1) {
      formdata[pos] = '\0';
      parseNameValue(formdata, &formdata[pos + 1]);
    }
  }
}


x86 assembly (clang, -O0):
<parsePostdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strpos@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
je     1186 <parsePostdata+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1030 <parsePostdata@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
add    %rax,%rdi
call   1030 <parsePostdata@plt>
jmp    11cb <parsePostdata+0x9b>
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1040 <strpos@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
je     11c6 <parsePostdata+0x96>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
add    %rax,%rsi
call   1050 <parseNameValue@plt>
jmp    11cb <parsePostdata+0x9b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsePostdata>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xec1(%rip),%rsi
call   1040 <strpos@plt>
cmp    $0xffffffff,%eax
je     1177 <parsePostdata+0x47>
lea    0xeb0(%rip),%r14
movslq %eax,%r15
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rdi
call   1030 <parsePostdata@plt>
add    %r15,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strpos@plt>
cmp    $0xffffffff,%eax
jne    1150 <parsePostdata+0x20>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strpos@plt>
cmp    $0xffffffff,%eax
je     11a6 <parsePostdata+0x76>
cltq
movb   $0x0,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <parseNameValue@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"&\00"
@.str.1 = [2 x i8] c"=\00"
define void @parsePostdata(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strpos(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %3
%6 = icmp ne i32 %5, -1
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
%12 = load i8*, i8** %2
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
br label %35
18: ; preds = %1
%19 = load i8*, i8** %2
%20 = call i32 @strpos(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %20, i32* %3
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %2
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = call i32 @parseNameValue(i8* %27, i8* %32)
br label %34
34: ; preds = %22, %18
br label %35
35: ; preds = %34, %7
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"&\00"
@.str.1 = [2 x i8] c"=\00"
define void @parsePostdata(i8* %0) {
%2 = tail call i32 @strpos(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, -1
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds i8, i8* %6, i64 %7
store i8 0, i8* %8
tail call void @parsePostdata(i8* %6)
%9 = add nuw nsw i32 %5, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
%12 = tail call i32 @strpos(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i8* [ %0, %1 ], [ %11, %4 ]
%16 = tail call i32 @strpos(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, -1
br i1 %17, label %25, label %18
18: ; preds = %14
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
store i8 0, i8* %20
%21 = add nuw nsw i32 %16, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %15, i64 %22
%24 = tail call i32 @parseNameValue(i8* %15, i8* %23)
br label %25
25: ; preds = %14, %18
ret void
}