#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 *mprStrnstr(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *p_user_name = "";
  char *p_passwd = "";
  char *url_query = "http://172.8.5.111/Streaming/channels/1/preview/"
                    "?username=admin&password=12345 ";
  p_user_name = mprStrnstr(url_query, "username=");
  p_passwd = mprStrnstr(url_query, "password=");
  printf("p_user_name = %s\n", p_user_name);
  printf("p_passwd = %s\n", p_passwd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf4e(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf43(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xef5(%rip),%rsi
call   1030 <mprStrnstr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeeb(%rip),%rsi
call   1030 <mprStrnstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xee1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xee3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%r14
lea    0xf1d(%rip),%rsi
mov    %r14,%rdi
call   1030 <mprStrnstr@plt>
mov    %rax,%r15
lea    0xf15(%rip),%rsi
mov    %r14,%rdi
call   1030 <mprStrnstr@plt>
mov    %rax,%rbx
lea    0xf0d(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
lea    0xf10(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [80 x i8] c"http://172.8.5.111/Streaming/channels/1/preview/?username=admin&password=12345 \00"
@.str.2 = [10 x i8] c"username=\00"
@.str.3 = [10 x i8] c"password=\00"
@.str.4 = [18 x i8] c"p_user_name = %s\0A\00"
@.str.5 = [15 x i8] c"p_passwd = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %4
%6 = call i8* @mprStrnstr(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i8* %6, i8** %2
%7 = load i8*, i8** %4
%8 = call i8* @mprStrnstr(i8* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i8* %8, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [80 x i8] c"http://172.8.5.111/Streaming/channels/1/preview/?username=admin&password=12345 \00"
@.str.2 = [10 x i8] c"username=\00"
@.str.3 = [10 x i8] c"password=\00"
@.str.4 = [18 x i8] c"p_user_name = %s\0A\00"
@.str.5 = [15 x i8] c"p_passwd = %s\0A\00"
define i32 @main() {
%1 = tail call i8* @mprStrnstr(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i8* @mprStrnstr(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %2)
ret i32 0
}