#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 archdep_spawn(char *, char **, char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ lib_free(char *);
char *lib_stralloc(char const *);
int compress_with_bzip(const char *src, const char *dest) {
  static char *argv[4];
  int exit_status;
  char *mdest;
  argv[0] = lib_stralloc("bzip2");
  argv[1] = lib_stralloc("-c");
  argv[2] = lib_stralloc(src);
  argv[3] = NULL;
  mdest = lib_stralloc(dest);
  ;
  exit_status = archdep_spawn("bzip2", argv, &mdest, NULL);
  lib_free(mdest);
  lib_free(argv[0]);
  lib_free(argv[1]);
  lib_free(argv[2]);
  if (exit_status == 0) {
    ;
    return 0;
  } else {
    ;
    return -1;
  }
}


x86 assembly (clang, -O0):
<compress_with_bzip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2efd(%rip)
lea    0xeac(%rip),%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2ef2(%rip)
mov    -0x10(%rbp),%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2eea(%rip)
movq   $0x0,0x2ee7(%rip)
mov    -0x18(%rbp),%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,-0x28(%rbp)
lea    0xe6b(%rip),%rdi
lea    0x2eb4(%rip),%rsi
lea    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <archdep_spawn@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <lib_free@plt>
mov    0x2e94(%rip),%rdi
call   1040 <lib_free@plt>
mov    0x2e90(%rip),%rdi
call   1040 <lib_free@plt>
mov    0x2e8c(%rip),%rdi
call   1040 <lib_free@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    11ef <compress_with_bzip+0xbf>
movl   $0x0,-0x4(%rbp)
jmp    11f6 <compress_with_bzip+0xc6>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compress_with_bzip>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%r14
mov    %r14,%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2efc(%rip)
lea    0x2ef5(%rip),%r12
lea    0xea4(%rip),%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2eea(%rip)
mov    %rbx,%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,0x2ee3(%rip)
movq   $0x0,0x2ee0(%rip)
mov    %r15,%rdi
call   1030 <lib_stralloc@plt>
mov    %rax,(%rsp)
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %ecx,%ecx
call   1050 <archdep_spawn@plt>
mov    %eax,%ebx
mov    (%rsp),%rdi
call   1040 <lib_free@plt>
mov    0x2e9a(%rip),%rdi
call   1040 <lib_free@plt>
mov    0x2e96(%rip),%rdi
call   1040 <lib_free@plt>
mov    0x2e92(%rip),%rdi
call   1040 <lib_free@plt>
neg    %ebx
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@compress_with_bzip.argv = internal global [4 x i8*] zeroinitializer
@.str = [6 x i8] c"bzip2\00"
@.str.1 = [3 x i8] c"-c\00"
define i32 @compress_with_bzip(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = call i8* @lib_stralloc(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0)
%9 = call i8* @lib_stralloc(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %9, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 1)
%10 = load i8*, i8** %4
%11 = call i8* @lib_stralloc(i8* %10)
store i8* %11, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 2)
store i8* null, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 3)
%12 = load i8*, i8** %5
%13 = call i8* @lib_stralloc(i8* %12)
store i8* %13, i8** %7
%14 = call i32 @archdep_spawn(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0), i8** %7, i32* null)
store i32 %14, i32* %6
%15 = load i8*, i8** %7
%16 = call i32 @lib_free(i8* %15)
%17 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0)
%18 = call i32 @lib_free(i8* %17)
%19 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 1)
%20 = call i32 @lib_free(i8* %19)
%21 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 2)
%22 = call i32 @lib_free(i8* %21)
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %2
store i32 0, i32* %3
br label %27
26: ; preds = %2
store i32 -1, i32* %3
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@compress_with_bzip.argv = internal global [4 x i8*] zeroinitializer
@.str = [6 x i8] c"bzip2\00"
@.str.1 = [3 x i8] c"-c\00"
define i32 @compress_with_bzip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i8* @lib_stralloc(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0)
%6 = tail call i8* @lib_stralloc(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %6, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 1)
%7 = tail call i8* @lib_stralloc(i8* %0)
store i8* %7, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 2)
store i8* null, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 3)
%8 = tail call i8* @lib_stralloc(i8* %1)
store i8* %8, i8** %3
%9 = call i32 @archdep_spawn(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0), i8** %3, i32* null)
%10 = load i8*, i8** %3
%11 = call i32 @lib_free(i8* %10)
%12 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 0)
%13 = call i32 @lib_free(i8* %12)
%14 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 1)
%15 = call i32 @lib_free(i8* %14)
%16 = load i8*, i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @compress_with_bzip.argv, i64 0, i64 2)
%17 = call i32 @lib_free(i8* %16)
%18 = icmp ne i32 %9, 0
%19 = sext i1 %18 to i32
ret i32 %19
}