#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 url_stat {
  int dummy;
};
struct url {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fetchFreeURL(struct url *);
struct url *fetchParseURL(char const *);
int /*<<< orphan*/ *fetchXGet(struct url *, struct url_stat *, char const *);
FILE *fetchXGetURL(const char *URL, struct url_stat *us, const char *flags) {
  struct url *u;
  FILE *f;
  if ((u = fetchParseURL(URL)) == NULL)
    return (NULL);
  f = fetchXGet(u, us, flags);
  fetchFreeURL(u);
  return (f);
}


x86 assembly (clang, -O0):
<fetchXGetURL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fetchParseURL@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1168 <fetchXGetURL+0x38>
movq   $0x0,-0x8(%rbp)
jmp    118e <fetchXGetURL+0x5e>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <fetchXGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <fetchFreeURL@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetchXGetURL>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <fetchParseURL@plt>
test   %rax,%rax
je     1166 <fetchXGetURL+0x36>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <fetchXGet@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <fetchFreeURL@plt>
mov    %r14,%rax
jmp    1168 <fetchXGetURL+0x38>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.url_stat = type { i32 }
%struct.url = type { i32 }
define i32* @fetchXGetURL(i8* %0, %struct.url_stat* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca %struct.url_stat*
%7 = alloca i8*
%8 = alloca %struct.url*
%9 = alloca i32*
store i8* %0, i8** %5
store %struct.url_stat* %1, %struct.url_stat** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %5
%11 = call %struct.url* @fetchParseURL(i8* %10)
store %struct.url* %11, %struct.url** %8
%12 = icmp eq %struct.url* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i32* null, i32** %4
br label %22
14: ; preds = %3
%15 = load %struct.url*, %struct.url** %8
%16 = load %struct.url_stat*, %struct.url_stat** %6
%17 = load i8*, i8** %7
%18 = call i32* @fetchXGet(%struct.url* %15, %struct.url_stat* %16, i8* %17)
store i32* %18, i32** %9
%19 = load %struct.url*, %struct.url** %8
%20 = call i32 @fetchFreeURL(%struct.url* %19)
%21 = load i32*, i32** %9
store i32* %21, i32** %4
br label %22
22: ; preds = %14, %13
%23 = load i32*, i32** %4
ret i32* %23
}

LLVM IR (-O2):
%struct.url_stat = type { i32 }
%struct.url = type { i32 }
define i32* @fetchXGetURL(i8* %0, %struct.url_stat* %1, i8* %2) {
%4 = tail call %struct.url* @fetchParseURL(i8* %0)
%5 = icmp eq %struct.url* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32* @fetchXGet(%struct.url* %4, %struct.url_stat* %1, i8* %2)
%8 = tail call i32 @fetchFreeURL(%struct.url* %4)
br label %9
9: ; preds = %3, %6
%10 = phi i32* [ %7, %6 ], [ null, %3 ]
ret i32* %10
}