#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 find_str(char *, char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strcat(char *, char *);
void make_get(char *dest, char *src) {
  int i;
  if (dest && src) {
    memset(dest, '\0', 2048);
    strcat(dest, "GET ");
    i = find_str(src, "twitter.com/");
    strcat(dest, src + i);
    strcat(dest, " HTTP/1.1\n");
  }
}


x86 assembly (clang, -O0):
<make_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ad <make_get+0x7d>
cmpq   $0x0,-0x10(%rbp)
je     11ad <make_get+0x7d>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <find_str@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
call   1050 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_get>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1192 <make_get+0x62>
mov    %rsi,%r14
test   %rsi,%rsi
je     1192 <make_get+0x62>
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x800,%edx
call   1040 <memset@plt>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xe9f(%rip),%rsi
mov    %r14,%rdi
call   1030 <find_str@plt>
movslq %eax,%rsi
add    %r14,%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strcat@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"GET \00"
@.str.1 = [13 x i8] c"twitter.com/\00"
@.str.2 = [11 x i8] c" HTTP/1.1\0A\00"
define void @make_get(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %26
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i8*, i8** %3
%13 = call i32 @memset(i8* %12, i8 signext 0, i32 2048)
%14 = load i8*, i8** %3
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = load i8*, i8** %4
%17 = call i32 @find_str(i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i32 %17, i32* %5
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = call i32 @strcat(i8* %18, i8* %22)
%24 = load i8*, i8** %3
%25 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %11, %8, %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"GET \00"
@.str.1 = [13 x i8] c"twitter.com/\00"
@.str.2 = [11 x i8] c" HTTP/1.1\0A\00"
define void @make_get(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = tail call i32 @memset(i8* %0, i8 signext 0, i32 2048)
%8 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @find_str(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = tail call i32 @strcat(i8* %0, i8* %11)
%13 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %6, %2
ret void
}