#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*/ free(char *);
char *getenv(char *);
int /*<<< orphan*/ interpret_url(char *, char **, char **, int *, char, char,
                                 char **, char **, char **);
void fetch_proxy_settings(char **proxy_user, char **proxy_password,
                          char **proxy_host, int *proxy_port, char use_ssl,
                          char use_ipv6) {
  char *str = getenv(use_ssl ? "https_proxy" : "http_proxy");
  if (!str) {
  }
  if (str) {
    char *path = NULL, *url = NULL;
    interpret_url(str, &path, proxy_host, proxy_port, use_ipv6, use_ssl, &url,
                  proxy_user, proxy_password);
    free(url);
    free(path);
  }
}


x86 assembly (clang, -O0):
<fetch_proxy_settings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %r8d,-0x5c(%rbp)
mov    %rcx,%rax
mov    -0x5c(%rbp),%ecx
mov    %rax,-0x58(%rbp)
mov    %rdx,%rax
mov    -0x58(%rbp),%rdx
mov    %rax,-0x50(%rbp)
mov    %rsi,%rax
mov    -0x50(%rbp),%rsi
mov    %rax,-0x48(%rbp)
mov    %rdi,%r8
mov    -0x48(%rbp),%rdi
mov    %r9b,%al
mov    %r8,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x21(%rbp)
mov    %al,-0x22(%rbp)
movsbl -0x21(%rbp),%ecx
lea    0xe82(%rip),%rdi
lea    0xe6f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <getenv@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11b1 <fetch_proxy_settings+0x81>
jmp    11b1 <fetch_proxy_settings+0x81>
cmpq   $0x0,-0x30(%rbp)
je     121d <fetch_proxy_settings+0xed>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x22(%rbp),%r8b
mov    -0x21(%rbp),%r9b
mov    -0x8(%rbp),%r10
mov    -0x10(%rbp),%rax
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%r11
movsbl %r8b,%r8d
movsbl %r9b,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <interpret_url@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetch_proxy_settings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebx
mov    %r8d,%ebp
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r14
test   %bpl,%bpl
lea    0xeb2(%rip),%rax
lea    0xe9f(%rip),%rdi
cmove  %rax,%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11c3 <fetch_proxy_settings+0x93>
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
sub    $0x8,%rsp
lea    0x10(%rsp),%r10
movsbl %bl,%r8d
movsbl %bpl,%r9d
lea    0x18(%rsp),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
mov    %r12,%rcx
push   %r15
push   %r14
push   %r10
call   1050 <interpret_url@plt>
add    $0x20,%rsp
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    0x10(%rsp),%rdi
call   1040 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"https_proxy\00"
@.str.1 = [11 x i8] c"http_proxy\00"
define void @fetch_proxy_settings(i8** %0, i8** %1, i8** %2, i32* %3, i8 signext %4, i8 signext %5) {
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
store i8** %0, i8*** %7
store i8** %1, i8*** %8
store i8** %2, i8*** %9
store i32* %3, i32** %10
store i8 %4, i8* %11
store i8 %5, i8* %12
%16 = load i8, i8* %11
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0)
%21 = call i8* @getenv(i8* %20)
store i8* %21, i8** %13
%22 = load i8*, i8** %13
%23 = icmp ne i8* %22, null
br i1 %23, label %25, label %24
24: ; preds = %6
br label %25
25: ; preds = %24, %6
%26 = load i8*, i8** %13
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %41
28: ; preds = %25
store i8* null, i8** %14
store i8* null, i8** %15
%29 = load i8*, i8** %13
%30 = load i8**, i8*** %9
%31 = load i32*, i32** %10
%32 = load i8, i8* %12
%33 = load i8, i8* %11
%34 = load i8**, i8*** %7
%35 = load i8**, i8*** %8
%36 = call i32 @interpret_url(i8* %29, i8** %14, i8** %30, i32* %31, i8 signext %32, i8 signext %33, i8** %15, i8** %34, i8** %35)
%37 = load i8*, i8** %15
%38 = call i32 @free(i8* %37)
%39 = load i8*, i8** %14
%40 = call i32 @free(i8* %39)
br label %41
41: ; preds = %28, %25
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"https_proxy\00"
@.str.1 = [11 x i8] c"http_proxy\00"
define void @fetch_proxy_settings(i8** %0, i8** %1, i8** %2, i32* %3, i8 signext %4, i8 signext %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = icmp eq i8 %4, 0
%10 = select i1 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
%11 = tail call i8* @getenv(i8* %10)
%12 = icmp eq i8* %11, null
br i1 %12, label %21, label %13
13: ; preds = %6
%14 = bitcast i8** %7 to i8*
store i8* null, i8** %7
%15 = bitcast i8** %8 to i8*
store i8* null, i8** %8
%16 = call i32 @interpret_url(i8* %11, i8** %7, i8** %2, i32* %3, i8 signext %5, i8 signext %4, i8** %8, i8** %0, i8** %1)
%17 = load i8*, i8** %8
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %7
%20 = call i32 @free(i8* %19)
br label %21
21: ; preds = %13, %6
ret void
}