#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 evhttp_uri {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ evhttp_uri_get_host(struct evhttp_uri *);
scalar_t__ evhttp_uri_get_port(struct evhttp_uri *);
struct evhttp_uri *evhttp_uri_parse(char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
struct evhttp_uri *uri_parse(const char *str) {
  struct evhttp_uri *uri;
  do {
    if (!(uri = evhttp_uri_parse(str))) {
      fprintf(stderr, "[error] %s\n", "uri = evhttp_uri_parse(str)");
      exit(EXIT_FAILURE);
    }
  } while (0);
  ;
  do {
    if (!(evhttp_uri_get_host(uri))) {
      fprintf(stderr, "[error] %s\n", "evhttp_uri_get_host(uri)");
      exit(EXIT_FAILURE);
    }
  } while (0);
  ;
  do {
    if (!(evhttp_uri_get_port(uri) > 0)) {
      fprintf(stderr, "[error] %s\n", "evhttp_uri_get_port(uri) > 0");
      exit(EXIT_FAILURE);
    }
  } while (0);
  ;
  return uri;
}


x86 assembly (clang, -O0):
<uri_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <evhttp_uri_parse@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    119d <uri_parse+0x4d>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
lea    0xe82(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    11a2 <uri_parse+0x52>
jmp    11a7 <uri_parse+0x57>
mov    -0x10(%rbp),%rdi
call   1040 <evhttp_uri_get_host@plt>
cmp    $0x0,%eax
jne    11e3 <uri_parse+0x93>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe37(%rip),%rsi
lea    0xe58(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    11e8 <uri_parse+0x98>
jmp    11ed <uri_parse+0x9d>
mov    -0x10(%rbp),%rdi
call   1050 <evhttp_uri_get_port@plt>
cmp    $0x0,%rax
jg     122a <uri_parse+0xda>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xdf0(%rip),%rsi
lea    0xe2a(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    122f <uri_parse+0xdf>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uri_parse>:
push   %rbx
call   1060 <evhttp_uri_parse@plt>
test   %rax,%rax
je     117c <uri_parse+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <evhttp_uri_get_host@plt>
test   %eax,%eax
je     1195 <uri_parse+0x45>
mov    %rbx,%rdi
call   1050 <evhttp_uri_get_port@plt>
test   %rax,%rax
jle    11ae <uri_parse+0x5e>
mov    %rbx,%rax
pop    %rbx
ret
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
lea    0xe79(%rip),%rdx
jmp    11c5 <uri_parse+0x75>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
lea    0xe7c(%rip),%rdx
jmp    11c5 <uri_parse+0x75>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.evhttp_uri = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"[error] %s\0A\00"
@.str.1 = [28 x i8] c"uri = evhttp_uri_parse(str)\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [25 x i8] c"evhttp_uri_get_host(uri)\00"
@.str.3 = [29 x i8] c"evhttp_uri_get_port(uri) > 0\00"
define %struct.evhttp_uri* @uri_parse(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.evhttp_uri*
store i8* %0, i8** %2
br label %4
4: ; preds = %1
%5 = load i8*, i8** %2
%6 = call %struct.evhttp_uri* @evhttp_uri_parse(i8* %5)
store %struct.evhttp_uri* %6, %struct.evhttp_uri** %3
%7 = icmp ne %struct.evhttp_uri* %6, null
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %4
br label %14
14: ; preds = %13
br label %15
15: ; preds = %14
%16 = load %struct.evhttp_uri*, %struct.evhttp_uri** %3
%17 = call i32 @evhttp_uri_get_host(%struct.evhttp_uri* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %15
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %15
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25
%27 = load %struct.evhttp_uri*, %struct.evhttp_uri** %3
%28 = call i64 @evhttp_uri_get_port(%struct.evhttp_uri* %27)
%29 = icmp sgt i64 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %26
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %26
br label %36
36: ; preds = %35
%37 = load %struct.evhttp_uri*, %struct.evhttp_uri** %3
ret %struct.evhttp_uri* %37
}

LLVM IR (-O2):
%struct.evhttp_uri = type { i32 }
@stderr = global i32 0
@.str = [12 x i8] c"[error] %s\0A\00"
@.str.1 = [28 x i8] c"uri = evhttp_uri_parse(str)\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [25 x i8] c"evhttp_uri_get_host(uri)\00"
@.str.3 = [29 x i8] c"evhttp_uri_get_port(uri) > 0\00"
define %struct.evhttp_uri* @uri_parse(i8* %0) {
%2 = tail call %struct.evhttp_uri* @evhttp_uri_parse(i8* %0)
%3 = icmp eq %struct.evhttp_uri* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = tail call i32 @evhttp_uri_get_host(%struct.evhttp_uri* %2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %9
%18 = tail call i64 @evhttp_uri_get_port(%struct.evhttp_uri* %2)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %17
ret %struct.evhttp_uri* %2
}