#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memmove(char *, char *, int);
char *oauth_url_unescape(char *, int /*<<< orphan*/ *);
scalar_t__ realloc(char **, int);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char const *);
int strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
char *strstr(char *, char *);
char *strtok(char *, char *);
int oauth_split_post_paramters(const char *url, char ***argv, short qesc) {
  int argc = 0;
  char *token, *tmp, *t1;
  if (!argv)
    return 0;
  if (!url)
    return 0;
  t1 = strdup(url);
  while ((qesc & 1) && (tmp = strchr(t1, '+')))
    *tmp = ' ';
  tmp = t1;
  while ((token = strtok(tmp, "&?"))) {
    if (!strncasecmp("oauth_signature=", token, 16))
      continue;
    (*argv) = (char **)realloc(*argv, sizeof(char *) * (argc + 1));
    while (!(qesc & 2) && (tmp = strchr(token, '\001')))
      *tmp = '&';
    if (argc > 0 || (qesc & 4))
      (*argv)[argc] = oauth_url_unescape(token, NULL);
    else
      (*argv)[argc] = strdup(token);
    if (argc == 0 && strstr(token, ":/")) {
      char *slash = strstr(token, ":/");
      while (slash && *(++slash) == '/')
        ;
      if (slash && !strchr(slash, '/')) {
        free((*argv)[argc]);
        (*argv)[argc] = (char *)malloc(sizeof(char) * (2 + strlen(token)));
        strcpy((*argv)[argc], token);
        strcat((*argv)[argc], "/");
      }
    }
    if (argc == 0 && (tmp = strstr((*argv)[argc], ":80/"))) {
      memmove(tmp, tmp + 3, strlen(tmp + 2));
    }
    tmp = NULL;
    argc++;
  }
  free(t1);
  return argc;
}


x86 assembly (clang, -O0):
<oauth_split_post_paramters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %dx,%ax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1205 <oauth_split_post_paramters+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1524 <oauth_split_post_paramters+0x354>
cmpq   $0x0,-0x10(%rbp)
jne    121c <oauth_split_post_paramters+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1524 <oauth_split_post_paramters+0x354>
mov    -0x10(%rbp),%rdi
call   10e0 <strdup@plt>
mov    %rax,-0x38(%rbp)
movswl -0x1a(%rbp),%ecx
and    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x41(%rbp)
je     125a <oauth_split_post_paramters+0x8a>
mov    -0x38(%rbp),%rdi
mov    $0x2b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    126a <oauth_split_post_paramters+0x9a>
jmp    1276 <oauth_split_post_paramters+0xa6>
mov    -0x30(%rbp),%rax
movb   $0x20,(%rax)
jmp    1229 <oauth_split_post_paramters+0x59>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1515 <oauth_split_post_paramters+0x345>
mov    -0x28(%rbp),%rsi
lea    0xd5c(%rip),%rdi
mov    $0x10,%edx
call   1090 <strncasecmp@plt>
cmp    $0x0,%eax
jne    12bf <oauth_split_post_paramters+0xef>
jmp    127e <oauth_split_post_paramters+0xae>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10a0 <realloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movswl -0x1a(%rbp),%ecx
and    $0x2,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x42(%rbp)
jne    1314 <oauth_split_post_paramters+0x144>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1060 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    1324 <oauth_split_post_paramters+0x154>
jmp    1330 <oauth_split_post_paramters+0x160>
mov    -0x30(%rbp),%rax
movb   $0x26,(%rax)
jmp    12e3 <oauth_split_post_paramters+0x113>
cmpl   $0x0,-0x20(%rbp)
jg     134a <oauth_split_post_paramters+0x17a>
movswl -0x1a(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     136e <oauth_split_post_paramters+0x19e>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <oauth_url_unescape@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    1389 <oauth_split_post_paramters+0x1b9>
mov    -0x28(%rbp),%rdi
call   10e0 <strdup@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
cmpl   $0x0,-0x20(%rbp)
jne    149c <oauth_split_post_paramters+0x2cc>
mov    -0x28(%rbp),%rdi
lea    0xc76(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     149c <oauth_split_post_paramters+0x2cc>
mov    -0x28(%rbp),%rdi
lea    0xc5c(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x40(%rbp)
mov    %al,-0x43(%rbp)
je     13ed <oauth_split_post_paramters+0x21d>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x43(%rbp)
mov    -0x43(%rbp),%al
test   $0x1,%al
jne    13fd <oauth_split_post_paramters+0x22d>
jmp    1402 <oauth_split_post_paramters+0x232>
jmp    13c1 <oauth_split_post_paramters+0x1f1>
cmpq   $0x0,-0x40(%rbp)
je     1497 <oauth_split_post_paramters+0x2c7>
mov    -0x40(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
jne    1497 <oauth_split_post_paramters+0x2c7>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x2,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb88(%rip),%rsi
call   10d0 <strcat@plt>
jmp    149c <oauth_split_post_paramters+0x2cc>
cmpl   $0x0,-0x20(%rbp)
jne    14ff <oauth_split_post_paramters+0x32f>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb5b(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     14ff <oauth_split_post_paramters+0x32f>
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x2,%rdi
call   1050 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
call   10b0 <memmove@plt>
movq   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    127e <oauth_split_post_paramters+0xae>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oauth_split_post_paramters>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebp,%ebp
test   %rdi,%rdi
je     13e3 <oauth_split_post_paramters+0x213>
test   %rsi,%rsi
je     13e3 <oauth_split_post_paramters+0x213>
mov    %edx,%ebx
mov    %rsi,0x10(%rsp)
call   10e0 <strdup@plt>
mov    %rax,%r14
movzwl %bx,%ebx
test   $0x1,%bl
jne    13c0 <oauth_split_post_paramters+0x1f0>
mov    %ebx,0xc(%rsp)
and    $0x4,%ebx
mov    %ebx,0x8(%rsp)
xor    %ebp,%ebp
lea    0xddf(%rip),%rbx
lea    0xddb(%rip),%r12
mov    %r14,%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   10c0 <strtok@plt>
test   %rax,%rax
je     13db <oauth_split_post_paramters+0x20b>
mov    %rax,%r13
mov    %r12,%rdi
mov    %rax,%rsi
mov    $0x10,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     1230 <oauth_split_post_paramters+0x60>
mov    0x10(%rsp),%r15
mov    (%r15),%rdi
lea    0x1(%rbp),%rax
mov    %rax,(%rsp)
lea    0x0(,%rax,8),%esi
call   10a0 <realloc@plt>
mov    %rax,(%r15)
testb  $0x2,0xc(%rsp)
jne    12a7 <oauth_split_post_paramters+0xd7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x1,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12a7 <oauth_split_post_paramters+0xd7>
movb   $0x26,(%rax)
jmp    1290 <oauth_split_post_paramters+0xc0>
mov    0x8(%rsp),%eax
mov    %r13,%rdi
or     %ebp,%eax
je     12bb <oauth_split_post_paramters+0xeb>
xor    %esi,%esi
call   1070 <oauth_url_unescape@plt>
jmp    12c0 <oauth_split_post_paramters+0xf0>
call   10e0 <strdup@plt>
mov    (%rsp),%rdx
mov    (%r15),%rcx
mov    %rax,(%rcx,%rbp,8)
mov    $0x0,%r15d
test   %rbp,%rbp
mov    %rdx,%rbp
jne    1230 <oauth_split_post_paramters+0x60>
mov    %r13,%rdi
lea    0xd2d(%rip),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
mov    0x10(%rsp),%rbp
je     1361 <oauth_split_post_paramters+0x191>
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x2f,0x1(%rax)
lea    0x1(%rax),%rax
je     1300 <oauth_split_post_paramters+0x130>
mov    %rax,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    1361 <oauth_split_post_paramters+0x191>
mov    0x0(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    0x2(%rax),%edi
call   1080 <malloc@plt>
mov    0x0(%rbp),%rcx
mov    %rax,(%rcx)
mov    0x0(%rbp),%rax
mov    (%rax),%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    0x0(%rbp),%rax
mov    (%rax),%rdi
lea    0xcbe(%rip),%rsi
call   10d0 <strcat@plt>
mov    0x0(%rbp),%rax
mov    (%rax),%rdi
lea    0xca8(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,%r13
mov    (%rsp),%rax
mov    %rax,%rbp
mov    $0x0,%r15d
test   %r13,%r13
je     1230 <oauth_split_post_paramters+0x60>
lea    0x3(%r13),%rbp
mov    %r13,%rdi
add    $0x2,%rdi
mov    %rax,%r15
call   1050 <strlen@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   10b0 <memmove@plt>
mov    %r15,%rbp
xor    %r15d,%r15d
jmp    1230 <oauth_split_post_paramters+0x60>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x2b,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     120d <oauth_split_post_paramters+0x3d>
movb   $0x20,(%rax)
jmp    13c0 <oauth_split_post_paramters+0x1f0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"&?\00"
@.str.1 = [17 x i8] c"oauth_signature=\00"
@.str.2 = [3 x i8] c":/\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [5 x i8] c":80/\00"
define i32 @oauth_split_post_paramters(i8* %0, i8*** %1, i16 signext %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8***
%7 = alloca i16
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %5
store i8*** %1, i8**** %6
store i16 %2, i16* %7
store i32 0, i32* %8
%13 = load i8***, i8**** %6
%14 = icmp ne i8*** %13, null
br i1 %14, label %16, label %15
15: ; preds = %3
store i32 0, i32* %4
br label %188
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %20, label %19
19: ; preds = %16
store i32 0, i32* %4
br label %188
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = call i8* @strdup(i8* %21)
store i8* %22, i8** %11
br label %23
23: ; preds = %34, %20
%24 = load i16, i16* %7
%25 = sext i16 %24 to i32
%26 = and i32 %25, 1
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %11
%30 = call i8* @strchr(i8* %29, i8 signext 43)
store i8* %30, i8** %10
%31 = icmp ne i8* %30, null
br label %32
32: ; preds = %28, %23
%33 = phi i1 [ false, %23 ], [ %31, %28 ]
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = load i8*, i8** %10
store i8 32, i8* %35
br label %23
36: ; preds = %32
%37 = load i8*, i8** %11
store i8* %37, i8** %10
br label %38
38: ; preds = %181, %46, %36
%39 = load i8*, i8** %10
%40 = call i8* @strtok(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %40, i8** %9
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %184
42: ; preds = %38
%43 = load i8*, i8** %9
%44 = call i32 @strncasecmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %43, i32 16)
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %42
br label %38
47: ; preds = %42
%48 = load i8***, i8**** %6
%49 = load i8**, i8*** %48
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = mul i64 8, %52
%54 = trunc i64 %53 to i32
%55 = call i64 @realloc(i8** %49, i32 %54)
%56 = inttoptr i64 %55 to i8**
%57 = load i8***, i8**** %6
store i8** %56, i8*** %57
br label %58
58: ; preds = %69, %47
%59 = load i16, i16* %7
%60 = sext i16 %59 to i32
%61 = and i32 %60, 2
%62 = icmp ne i32 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %58
%64 = load i8*, i8** %9
%65 = call i8* @strchr(i8* %64, i8 signext 1)
store i8* %65, i8** %10
%66 = icmp ne i8* %65, null
br label %67
67: ; preds = %63, %58
%68 = phi i1 [ false, %58 ], [ %66, %63 ]
br i1 %68, label %69, label %71
69: ; preds = %67
%70 = load i8*, i8** %10
store i8 38, i8* %70
br label %58
71: ; preds = %67
%72 = load i32, i32* %8
%73 = icmp sgt i32 %72, 0
br i1 %73, label %79, label %74
74: ; preds = %71
%75 = load i16, i16* %7
%76 = sext i16 %75 to i32
%77 = and i32 %76, 4
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %87
79: ; preds = %74, %71
%80 = load i8*, i8** %9
%81 = call i8* @oauth_url_unescape(i8* %80, i32* null)
%82 = load i8***, i8**** %6
%83 = load i8**, i8*** %82
%84 = load i32, i32* %8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
store i8* %81, i8** %86
br label %95
87: ; preds = %74
%88 = load i8*, i8** %9
%89 = call i8* @strdup(i8* %88)
%90 = load i8***, i8**** %6
%91 = load i8**, i8*** %90
%92 = load i32, i32* %8
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8*, i8** %91, i64 %93
store i8* %89, i8** %94
br label %95
95: ; preds = %87, %79
%96 = load i32, i32* %8
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %161
98: ; preds = %95
%99 = load i8*, i8** %9
%100 = call i8* @strstr(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%101 = icmp ne i8* %100, null
br i1 %101, label %102, label %161
102: ; preds = %98
%103 = load i8*, i8** %9
%104 = call i8* @strstr(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %104, i8** %12
br label %105
105: ; preds = %116, %102
%106 = load i8*, i8** %12
%107 = icmp ne i8* %106, null
br i1 %107, label %108, label %114
108: ; preds = %105
%109 = load i8*, i8** %12
%110 = getelementptr inbounds i8, i8* %109, i32 1
store i8* %110, i8** %12
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 47
br label %114
114: ; preds = %108, %105
%115 = phi i1 [ false, %105 ], [ %113, %108 ]
br i1 %115, label %116, label %117
116: ; preds = %114
br label %105
117: ; preds = %114
%118 = load i8*, i8** %12
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %160
120: ; preds = %117
%121 = load i8*, i8** %12
%122 = call i8* @strchr(i8* %121, i8 signext 47)
%123 = icmp ne i8* %122, null
br i1 %123, label %160, label %124
124: ; preds = %120
%125 = load i8***, i8**** %6
%126 = load i8**, i8*** %125
%127 = load i32, i32* %8
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8*, i8** %126, i64 %128
%130 = load i8*, i8** %129
%131 = call i32 @free(i8* %130)
%132 = load i8*, i8** %9
%133 = call i32 @strlen(i8* %132)
%134 = add nsw i32 2, %133
%135 = sext i32 %134 to i64
%136 = mul i64 1, %135
%137 = trunc i64 %136 to i32
%138 = call i64 @malloc(i32 %137)
%139 = inttoptr i64 %138 to i8*
%140 = load i8***, i8**** %6
%141 = load i8**, i8*** %140
%142 = load i32, i32* %8
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %141, i64 %143
store i8* %139, i8** %144
%145 = load i8***, i8**** %6
%146 = load i8**, i8*** %145
%147 = load i32, i32* %8
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i8*, i8** %146, i64 %148
%150 = load i8*, i8** %149
%151 = load i8*, i8** %9
%152 = call i32 @strcpy(i8* %150, i8* %151)
%153 = load i8***, i8**** %6
%154 = load i8**, i8*** %153
%155 = load i32, i32* %8
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8*, i8** %154, i64 %156
%158 = load i8*, i8** %157
%159 = call i32 @strcat(i8* %158, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %160
160: ; preds = %124, %120, %117
br label %161
161: ; preds = %160, %98, %95
%162 = load i32, i32* %8
%163 = icmp eq i32 %162, 0
br i1 %163, label %164, label %181
164: ; preds = %161
%165 = load i8***, i8**** %6
%166 = load i8**, i8*** %165
%167 = load i32, i32* %8
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds i8*, i8** %166, i64 %168
%170 = load i8*, i8** %169
%171 = call i8* @strstr(i8* %170, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8* %171, i8** %10
%172 = icmp ne i8* %171, null
br i1 %172, label %173, label %181
173: ; preds = %164
%174 = load i8*, i8** %10
%175 = load i8*, i8** %10
%176 = getelementptr inbounds i8, i8* %175, i64 3
%177 = load i8*, i8** %10
%178 = getelementptr inbounds i8, i8* %177, i64 2
%179 = call i32 @strlen(i8* %178)
%180 = call i32 @memmove(i8* %174, i8* %176, i32 %179)
br label %181
181: ; preds = %173, %164, %161
store i8* null, i8** %10
%182 = load i32, i32* %8
%183 = add nsw i32 %182, 1
store i32 %183, i32* %8
br label %38
184: ; preds = %38
%185 = load i8*, i8** %11
%186 = call i32 @free(i8* %185)
%187 = load i32, i32* %8
store i32 %187, i32* %4
br label %188
188: ; preds = %184, %19, %15
%189 = load i32, i32* %4
ret i32 %189
}

LLVM IR (-O2):
@.str = [3 x i8] c"&?\00"
@.str.1 = [17 x i8] c"oauth_signature=\00"
@.str.2 = [3 x i8] c":/\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [5 x i8] c":80/\00"
define i32 @oauth_split_post_paramters(i8* %0, i8*** %1, i16 signext %2) {
%4 = icmp eq i8*** %1, null
%5 = icmp eq i8* %0, null
%6 = or i1 %5, %4
br i1 %6, label %99, label %7
7: ; preds = %3
%8 = tail call i8* @strdup(i8* %0)
%9 = zext i16 %2 to i32
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %7
%13 = tail call i8* @strchr(i8* dereferenceable(1) %8, i8 signext 43)
%14 = icmp eq i8* %13, null
br i1 %14, label %19, label %15
15: ; preds = %12, %15
%16 = phi i8* [ %17, %15 ], [ %13, %12 ]
store i8 32, i8* %16
%17 = tail call i8* @strchr(i8* dereferenceable(1) %8, i8 signext 43)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %15
19: ; preds = %15, %12, %7
%20 = and i32 %9, 2
%21 = icmp eq i32 %20, 0
%22 = and i32 %9, 4
br label %23
23: ; preds = %59, %19
%24 = phi i64 [ 0, %19 ], [ %34, %59 ]
%25 = phi i8* [ %8, %19 ], [ null, %59 ]
br label %26
26: ; preds = %23, %29
%27 = tail call i8* @strtok(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i8* %27, null
br i1 %28, label %96, label %29
29: ; preds = %26
%30 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %27, i32 16)
%31 = icmp eq i32 %30, 0
br i1 %31, label %26, label %32
32: ; preds = %29
%33 = load i8**, i8*** %1
%34 = add nuw i64 %24, 1
%35 = trunc i64 %34 to i32
%36 = shl i32 %35, 3
%37 = tail call i64 @realloc(i8** %33, i32 %36)
%38 = inttoptr i64 %37 to i8**
store i8** %38, i8*** %1
br i1 %21, label %39, label %46
39: ; preds = %32
%40 = tail call i8* @strchr(i8* %27, i8 signext 1)
%41 = icmp eq i8* %40, null
br i1 %41, label %46, label %42
42: ; preds = %39, %42
%43 = phi i8* [ %44, %42 ], [ %40, %39 ]
store i8 38, i8* %43
%44 = tail call i8* @strchr(i8* %27, i8 signext 1)
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %42
46: ; preds = %42, %39, %32
%47 = trunc i64 %24 to i32
%48 = or i32 %22, %47
%49 = icmp eq i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = tail call i8* @oauth_url_unescape(i8* %27, i32* null)
br label %54
52: ; preds = %46
%53 = tail call i8* @strdup(i8* %27)
br label %54
54: ; preds = %52, %50
%55 = phi i8* [ %53, %52 ], [ %51, %50 ]
%56 = load i8**, i8*** %1
%57 = getelementptr inbounds i8*, i8** %56, i64 %24
store i8* %55, i8** %57
%58 = icmp eq i64 %24, 0
br i1 %58, label %60, label %59
59: ; preds = %54, %91, %86
br label %23
60: ; preds = %54
%61 = tail call i8* @strstr(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%62 = icmp eq i8* %61, null
br i1 %62, label %86, label %63
63: ; preds = %60, %63
%64 = phi i8* [ %65, %63 ], [ %61, %60 ]
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 47
br i1 %67, label %63, label %68
68: ; preds = %63
%69 = tail call i8* @strchr(i8* %65, i8 signext 47)
%70 = icmp eq i8* %69, null
br i1 %70, label %71, label %86
71: ; preds = %68
%72 = load i8**, i8*** %1
%73 = load i8*, i8** %72
%74 = tail call i32 @free(i8* %73)
%75 = tail call i32 @strlen(i8* %27)
%76 = add nsw i32 %75, 2
%77 = tail call i64 @malloc(i32 %76)
%78 = inttoptr i64 %77 to i8*
%79 = load i8**, i8*** %1
store i8* %78, i8** %79
%80 = load i8**, i8*** %1
%81 = load i8*, i8** %80
%82 = tail call i32 @strcpy(i8* %81, i8* %27)
%83 = load i8**, i8*** %1
%84 = load i8*, i8** %83
%85 = tail call i32 @strcat(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %86
86: ; preds = %60, %71, %68
%87 = load i8**, i8*** %1
%88 = load i8*, i8** %87
%89 = tail call i8* @strstr(i8* dereferenceable(1) %88, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%90 = icmp eq i8* %89, null
br i1 %90, label %59, label %91
91: ; preds = %86
%92 = getelementptr inbounds i8, i8* %89, i64 3
%93 = getelementptr inbounds i8, i8* %89, i64 2
%94 = tail call i32 @strlen(i8* %93)
%95 = tail call i32 @memmove(i8* %89, i8* %92, i32 %94)
br label %59
96: ; preds = %26
%97 = trunc i64 %24 to i32
%98 = tail call i32 @free(i8* %8)
br label %99
99: ; preds = %3, %96
%100 = phi i32 [ %97, %96 ], [ 0, %3 ]
ret i32 %100
}