#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 */
struct field {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free_kv(struct field *, unsigned int);
struct field *get_data(char const *, unsigned int *);
char *get_host(char const *);
struct field *get_params(char const *, unsigned int *);
char *get_uri(char const *);
char *http_request(char *, char const *, char const *, char *, struct field *,
                   unsigned int, struct field *, unsigned int, int);
char *zurl(const char *url, char *opt) {
  const char *host = get_host(url);
  const char *uri = get_uri(url);
  unsigned int m, n;
  m = n = 0;
  struct field *data = get_data(uri, &m);
  struct field *params = get_params(uri, &n);
  char *buffer =
      http_request("GET", host, uri, "HTTP/1.1", params, m, data, n, 1);
  free_kv(data, m);
  free_kv(params, n);
  return buffer;
}


x86 assembly (clang, -O0):
<zurl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_host@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_uri@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1080 <get_data@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <get_params@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x38(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    -0x30(%rbp),%r10
mov    -0x28(%rbp),%eax
lea    0xe28(%rip),%rdi
lea    0xe25(%rip),%rcx
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1070 <http_request@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <free_kv@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1030 <free_kv@plt>
mov    -0x40(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zurl>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <get_host@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <get_uri@plt>
mov    %rax,%rbx
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
call   1080 <get_data@plt>
mov    %rax,%r15
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <get_params@plt>
mov    %rax,%r12
mov    0x4(%rsp),%r9d
mov    (%rsp),%eax
sub    $0x8,%rsp
lea    0xe42(%rip),%rdi
lea    0xe3f(%rip),%rcx
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%r8
push   $0x1
push   %rax
push   %r15
call   1070 <http_request@plt>
add    $0x20,%rsp
mov    %rax,%rbx
mov    0x4(%rsp),%esi
mov    %r15,%rdi
call   1030 <free_kv@plt>
mov    (%rsp),%esi
mov    %r12,%rdi
call   1030 <free_kv@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.field = type { i32 }
@.str = [4 x i8] c"GET\00"
@.str.1 = [9 x i8] c"HTTP/1.1\00"
define i8* @zurl(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.field*
%10 = alloca %struct.field*
%11 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%12 = load i8*, i8** %3
%13 = call i8* @get_host(i8* %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %3
%15 = call i8* @get_uri(i8* %14)
store i8* %15, i8** %6
store i32 0, i32* %8
store i32 0, i32* %7
%16 = load i8*, i8** %6
%17 = call %struct.field* @get_data(i8* %16, i32* %7)
store %struct.field* %17, %struct.field** %9
%18 = load i8*, i8** %6
%19 = call %struct.field* @get_params(i8* %18, i32* %8)
store %struct.field* %19, %struct.field** %10
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = load %struct.field*, %struct.field** %10
%23 = load i32, i32* %7
%24 = load %struct.field*, %struct.field** %9
%25 = load i32, i32* %8
%26 = call i8* @http_request(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.field* %22, i32 %23, %struct.field* %24, i32 %25, i32 1)
store i8* %26, i8** %11
%27 = load %struct.field*, %struct.field** %9
%28 = load i32, i32* %7
%29 = call i32 @free_kv(%struct.field* %27, i32 %28)
%30 = load %struct.field*, %struct.field** %10
%31 = load i32, i32* %8
%32 = call i32 @free_kv(%struct.field* %30, i32 %31)
%33 = load i8*, i8** %11
ret i8* %33
}

LLVM IR (-O2):
%struct.field = type { i32 }
@.str = [4 x i8] c"GET\00"
@.str.1 = [9 x i8] c"HTTP/1.1\00"
define i8* @zurl(i8* %0, i8* nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = tail call i8* @get_host(i8* %0)
%6 = tail call i8* @get_uri(i8* %0)
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
store i32 0, i32* %3
%9 = call %struct.field* @get_data(i8* %6, i32* %3)
%10 = call %struct.field* @get_params(i8* %6, i32* %4)
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i8* @http_request(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.field* %10, i32 %11, %struct.field* %9, i32 %12, i32 1)
%14 = load i32, i32* %3
%15 = call i32 @free_kv(%struct.field* %9, i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @free_kv(%struct.field* %10, i32 %16)
ret i8* %13
}