#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 */
char *strstr(char *, char *);
char *ph_parseCallProgressUri2(char *data) {
  char *tag = strstr(data, "URI2=");
  char *eos;
  if (!tag)
    return 0;
  eos = tag + 4;
  while (*eos && *eos != ' ')
    *eos++;
  *eos = 0;
  return tag + 4;
}


x86 assembly (clang, -O0):
<ph_parseCallProgressUri2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <ph_parseCallProgressUri2+0x38>
movq   $0x0,-0x8(%rbp)
jmp    11ad <ph_parseCallProgressUri2+0x9d>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1179 <ph_parseCallProgressUri2+0x69>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1189 <ph_parseCallProgressUri2+0x79>
jmp    119a <ph_parseCallProgressUri2+0x8a>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1154 <ph_parseCallProgressUri2+0x44>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ph_parseCallProgressUri2>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     113e <ph_parseCallProgressUri2+0x2e>
add    $0x4,%rax
mov    %rax,%rcx
testb  $0xdf,(%rcx)
je     1139 <ph_parseCallProgressUri2+0x29>
xchg   %ax,%ax
add    $0x1,%rcx
testb  $0xdf,(%rcx)
jne    1130 <ph_parseCallProgressUri2+0x20>
movb   $0x0,(%rcx)
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"URI2=\00"
define i8* @ph_parseCallProgressUri2(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 4
br label %6
6: ; preds = %9, %4
%7 = phi i8* [ %5, %4 ], [ %10, %9 ]
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 0, label %11
i8 32, label %11
]
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
br label %6
11: ; preds = %6, %6
store i8 0, i8* %7
br label %12
12: ; preds = %1, %11
%13 = phi i8* [ %5, %11 ], [ null, %1 ]
ret i8* %13
}