#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*/ archdep_file_is_gzip(char const *);
char *archdep_filename_parameter(char const *);
int archdep_spawn(char *, char **, char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ ioutil_remove(char *);
int /*<<< orphan*/ lib_free(char *);
char *lib_stralloc(char *);
char *try_uncompress_with_gzip(const char *name) {
  char *tmp_name = NULL;
  int exit_status;
  char *argv[4];
  if (!archdep_file_is_gzip(name))
    return NULL;
  argv[0] = lib_stralloc("gzip");
  argv[1] = lib_stralloc("-cd");
  argv[2] = archdep_filename_parameter(name);
  argv[3] = NULL;
  ;
  exit_status = archdep_spawn("gzip", argv, &tmp_name, NULL);
  lib_free(argv[0]);
  lib_free(argv[1]);
  lib_free(argv[2]);
  if (exit_status == 0) {
    ;
    return tmp_name;
  } else {
    ;
    ioutil_remove(tmp_name);
    lib_free(tmp_name);
    return NULL;
  }
}


x86 assembly (clang, -O0):
<try_uncompress_with_gzip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <archdep_file_is_gzip@plt>
cmp    $0x0,%eax
jne    1193 <try_uncompress_with_gzip+0x33>
movq   $0x0,-0x8(%rbp)
jmp    122f <try_uncompress_with_gzip+0xcf>
lea    0xe66(%rip),%rdi
call   1040 <lib_stralloc@plt>
mov    %rax,-0x40(%rbp)
lea    0xe5b(%rip),%rdi
call   1040 <lib_stralloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <archdep_filename_parameter@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe2d(%rip),%rdi
lea    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1060 <archdep_spawn@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <lib_free@plt>
mov    -0x38(%rbp),%rdi
call   1050 <lib_free@plt>
mov    -0x30(%rbp),%rdi
call   1050 <lib_free@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1215 <try_uncompress_with_gzip+0xb5>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    122f <try_uncompress_with_gzip+0xcf>
mov    -0x18(%rbp),%rdi
call   1070 <ioutil_remove@plt>
mov    -0x18(%rbp),%rdi
call   1050 <lib_free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try_uncompress_with_gzip>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
call   1080 <archdep_file_is_gzip@plt>
test   %eax,%eax
je     120a <try_uncompress_with_gzip+0xaa>
lea    0xe79(%rip),%r14
mov    %r14,%rdi
call   1040 <lib_stralloc@plt>
mov    %rax,0x10(%rsp)
lea    0xe6a(%rip),%rdi
call   1040 <lib_stralloc@plt>
mov    %rax,0x18(%rsp)
mov    %rbx,%rdi
call   1030 <archdep_filename_parameter@plt>
mov    %rax,0x20(%rsp)
movq   $0x0,0x28(%rsp)
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
xor    %ecx,%ecx
call   1060 <archdep_spawn@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%rdi
call   1050 <lib_free@plt>
mov    0x18(%rsp),%rdi
call   1050 <lib_free@plt>
mov    0x20(%rsp),%rdi
call   1050 <lib_free@plt>
mov    0x8(%rsp),%rax
test   %ebx,%ebx
je     120c <try_uncompress_with_gzip+0xac>
mov    %rax,%rdi
call   1070 <ioutil_remove@plt>
mov    0x8(%rsp),%rdi
call   1050 <lib_free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"gzip\00"
@.str.1 = [4 x i8] c"-cd\00"
define i8* @try_uncompress_with_gzip(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [4 x i8*]
store i8* %0, i8** %3
store i8* null, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @archdep_file_is_gzip(i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
store i8* null, i8** %2
br label %40
11: ; preds = %1
%12 = call i8* @lib_stralloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 0
store i8* %12, i8** %13
%14 = call i8* @lib_stralloc(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
store i8* %14, i8** %15
%16 = load i8*, i8** %3
%17 = call i8* @archdep_filename_parameter(i8* %16)
%18 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 2
store i8* %17, i8** %18
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 3
store i8* null, i8** %19
%20 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 0
%21 = call i32 @archdep_spawn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %20, i8** %4, i32* null)
store i32 %21, i32* %5
%22 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @lib_free(i8* %23)
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @lib_free(i8* %26)
%28 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @lib_free(i8* %29)
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %11
%34 = load i8*, i8** %4
store i8* %34, i8** %2
br label %40
35: ; preds = %11
%36 = load i8*, i8** %4
%37 = call i32 @ioutil_remove(i8* %36)
%38 = load i8*, i8** %4
%39 = call i32 @lib_free(i8* %38)
store i8* null, i8** %2
br label %40
40: ; preds = %35, %33, %10
%41 = load i8*, i8** %2
ret i8* %41
}

LLVM IR (-O2):
@.str = [5 x i8] c"gzip\00"
@.str.1 = [4 x i8] c"-cd\00"
define i8* @try_uncompress_with_gzip(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8*]
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast [4 x i8*]* %3 to i8*
%6 = tail call i32 @archdep_file_is_gzip(i8* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %29, label %8
8: ; preds = %1
%9 = tail call i8* @lib_stralloc(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
store i8* %9, i8** %10
%11 = tail call i8* @lib_stralloc(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
store i8* %11, i8** %12
%13 = tail call i8* @archdep_filename_parameter(i8* %0)
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
store i8* %13, i8** %14
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
store i8* null, i8** %15
%16 = call i32 @archdep_spawn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %10, i8** %2, i32* null)
%17 = load i8*, i8** %10
%18 = call i32 @lib_free(i8* %17)
%19 = load i8*, i8** %12
%20 = call i32 @lib_free(i8* %19)
%21 = load i8*, i8** %14
%22 = call i32 @lib_free(i8* %21)
%23 = icmp eq i32 %16, 0
%24 = load i8*, i8** %2
br i1 %23, label %29, label %25
25: ; preds = %8
%26 = call i32 @ioutil_remove(i8* %24)
%27 = load i8*, i8** %2
%28 = call i32 @lib_free(i8* %27)
br label %29
29: ; preds = %8, %1, %25
%30 = phi i8* [ null, %25 ], [ null, %1 ], [ %24, %8 ]
ret i8* %30
}