#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int bozv_entry_delete(char *);
int bozv_entry_new(char **);
int bozv_entry_seturi(char *, char *);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int);
int main(int ac, char **av) {
  int ret = 0;
  char *entry = NULL;
  (void)ac;
  (void)av;
  ret = bozv_entry_new(&entry);
  if (ret < 0) {
    fprintf(stderr, "Unable to open video handle, errno(%d/%s)\n", errno,
            strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "New entry(%s)\n", entry);
  fprintf(stdout, "Press key to continue\n");
  getchar();
  ret = bozv_entry_seturi(entry, "rtsp://192.168.0.1/test");
  if (ret < 0) {
    fprintf(stderr, "Unable to create uri, errno(%d/%s)\n", errno,
            strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "Press key to continue\n");
  getchar();
  ret = bozv_entry_delete(entry);
  if (ret < 0) {
    fprintf(stderr, "Unable to close video handle, errno(%d/%s)\n", errno,
            strerror(errno));
    exit(EXIT_FAILURE);
  }
  fprintf(stdout, "All test succeeded\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <bozv_entry_new@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11f6 <main+0x86>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%edx
mov    %rax,%rcx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x20(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1080 <bozv_entry_seturi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1297 <main+0x127>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    %rax,%rcx
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x20(%rbp),%rdi
call   1040 <bozv_entry_delete@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1316 <main+0x1a6>
mov    0x2d0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2cfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%edx
mov    %rax,%rcx
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1030 <bozv_entry_new@plt>
test   %eax,%eax
jns    11ac <main+0x3c>
mov    0x2e52(%rip),%rax
mov    (%rax),%ebx
mov    0x2e41(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1090 <strerror@plt>
lea    0xe59(%rip),%rsi
jmp    1258 <main+0xe8>
mov    0x2e15(%rip),%rbx
mov    (%rbx),%edi
mov    (%rsp),%rdx
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe6a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    (%rsp),%rdi
lea    0xe68(%rip),%rsi
call   1080 <bozv_entry_seturi@plt>
test   %eax,%eax
jns    1214 <main+0xa4>
mov    0x2de7(%rip),%rax
mov    (%rax),%ebx
mov    0x2dd6(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1090 <strerror@plt>
lea    0xe57(%rip),%rsi
jmp    1258 <main+0xe8>
mov    (%rbx),%edi
lea    0xe1d(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    (%rsp),%rdi
call   1040 <bozv_entry_delete@plt>
test   %eax,%eax
jns    1274 <main+0x104>
mov    0x2da1(%rip),%rax
mov    (%rax),%ebx
mov    0x2d90(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1090 <strerror@plt>
lea    0xe35(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    (%rbx),%edi
lea    0xe3c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Unable to open video handle, errno(%d/%s)\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [15 x i8] c"New entry(%s)\0A\00"
@.str.2 = [23 x i8] c"Press key to continue\0A\00"
@.str.3 = [24 x i8] c"rtsp://192.168.0.1/test\00"
@.str.4 = [36 x i8] c"Unable to create uri, errno(%d/%s)\0A\00"
@.str.5 = [44 x i8] c"Unable to close video handle, errno(%d/%s)\0A\00"
@.str.6 = [20 x i8] c"All test succeeded\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %7
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @bozv_entry_new(i8** %7)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = load i32, i32* @errno
%17 = call i8* @strerror(i32 %16)
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i32, i32* @stdout
%23 = load i8*, i8** %7
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @stdout
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 (...) @getchar()
%28 = load i8*, i8** %7
%29 = call i32 @bozv_entry_seturi(i8* %28, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %21
%33 = load i32, i32* @stderr
%34 = load i32, i32* @errno
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %34, i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %21
%41 = load i32, i32* @stdout
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%43 = call i32 (...) @getchar()
%44 = load i8*, i8** %7
%45 = call i32 @bozv_entry_delete(i8* %44)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %56
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = load i32, i32* @errno
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %50, i8* %52)
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %40
%57 = load i32, i32* @stdout
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%59 = load i32, i32* @EXIT_SUCCESS
%60 = call i32 @exit(i32 %59)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Unable to open video handle, errno(%d/%s)\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [15 x i8] c"New entry(%s)\0A\00"
@.str.2 = [23 x i8] c"Press key to continue\0A\00"
@.str.3 = [24 x i8] c"rtsp://192.168.0.1/test\00"
@.str.4 = [36 x i8] c"Unable to create uri, errno(%d/%s)\0A\00"
@.str.5 = [44 x i8] c"Unable to close video handle, errno(%d/%s)\0A\00"
@.str.6 = [20 x i8] c"All test succeeded\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @bozv_entry_new(i8** %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i32, i32* @stdout
%16 = load i8*, i8** %3
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stdout
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (...) @getchar()
%21 = load i8*, i8** %3
%22 = call i32 @bozv_entry_seturi(i8* %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %14
%25 = load i32, i32* @stderr
%26 = load i32, i32* @errno
%27 = call i8* @strerror(i32 %26)
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %26, i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %14
%32 = load i32, i32* @stdout
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 (...) @getchar()
%35 = load i8*, i8** %3
%36 = call i32 @bozv_entry_delete(i8* %35)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %31
%39 = load i32, i32* @stderr
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %40, i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %31
%46 = load i32, i32* @stdout
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%48 = load i32, i32* @EXIT_SUCCESS
%49 = call i32 @exit(i32 %48)
unreachable
}