#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 *);
char *getURL(char *req_message, char *URL) {
  int i = 0;
  char temp[2048];
  char *temp_URL;
  strcpy(temp, req_message);
  temp_URL = &temp[4];
  i = 0;
  while (temp_URL[i] != ' ')
    i++;
  temp_URL[i] = '\0';
  strcpy(URL, temp_URL);
  return URL;
}


x86 assembly (clang, -O0):
<getURL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x820(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x820(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x828(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x828(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1179 <getURL+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <getURL+0x43>
mov    -0x828(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getURL>:
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    $0xffffffffffffffff,%rax
lea    0x4(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x20,0x5(%rsp,%rax,1)
lea    0x1(%rax),%rax
jne    1140 <getURL+0x30>
mov    %eax,%eax
movb   $0x0,0x4(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x800,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getURL(i8* %0, i8* returned %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %0)
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 4
br label %7
7: ; preds = %7, %2
%8 = phi i64 [ %12, %7 ], [ 0, %2 ]
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 32
%12 = add nuw i64 %8, 1
br i1 %11, label %13, label %7
13: ; preds = %7
%14 = and i64 %8, 4294967295
%15 = getelementptr inbounds i8, i8* %6, i64 %14
store i8 0, i8* %15
%16 = call i32 @strcpy(i8* %1, i8* %6)
ret i8* %1
}