#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *,
                            char *);
int system(char *);
int compile(char *filename, char *out) {
  char *cc;
  int status;
  cc = (char *)malloc(sizeof(char *) * 200);
  snprintf(cc, 200, "%s %s -o %s %s\n", "gcc", "-std=c99", out, filename);
  status = system(cc);
  if (out != NULL) {
    free(out);
    out = NULL;
  }
  if (cc != NULL) {
    free(cc);
    cc = NULL;
  }
  return !status;
}


x86 assembly (clang, -O0):
<compile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x640,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%r9
mov    -0x8(%rbp),%rax
mov    $0xc8,%esi
lea    0xe8a(%rip),%rdx
lea    0xe93(%rip),%rcx
lea    0xe90(%rip),%r8
mov    %rax,(%rsp)
call   1050 <snprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b5 <compile+0x75>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d1 <compile+0x91>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compile>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbp
mov    $0x640,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,(%rsp)
lea    0xe9a(%rip),%rdx
lea    0xea3(%rip),%rcx
lea    0xea0(%rip),%r8
mov    %rax,%rdi
mov    $0xc8,%esi
mov    %r14,%r9
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %eax,%ebp
test   %r14,%r14
je     119b <compile+0x5b>
mov    %r14,%rdi
call   1030 <free@plt>
test   %rbx,%rbx
je     11a8 <compile+0x68>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%s %s -o %s %s\0A\00"
@.str.1 = [4 x i8] c"gcc\00"
@.str.2 = [9 x i8] c"-std=c99\00"
define i32 @compile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = call i64 @malloc(i32 1600)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = call i32 @snprintf(i8* %9, i32 200, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = call i32 @system(i8* %13)
store i32 %14, i32* %6
%15 = load i8*, i8** %4
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
store i8* null, i8** %4
br label %20
20: ; preds = %17, %2
%21 = load i8*, i8** %5
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i8*, i8** %5
%25 = call i32 @free(i8* %24)
store i8* null, i8** %5
br label %26
26: ; preds = %23, %20
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s %s -o %s %s\0A\00"
@.str.1 = [4 x i8] c"gcc\00"
@.str.2 = [9 x i8] c"-std=c99\00"
define i32 @compile(i8* %0, i8* %1) {
%3 = tail call i64 @malloc(i32 1600)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @snprintf(i8* %4, i32 200, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %0)
%6 = tail call i32 @system(i8* %4)
%7 = icmp eq i8* %1, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @free(i8* %1)
br label %10
10: ; preds = %8, %2
%11 = icmp eq i64 %3, 0
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = tail call i32 @free(i8* %4)
br label %14
14: ; preds = %12, %10
%15 = icmp eq i32 %6, 0
%16 = zext i1 %15 to i32
ret i32 %16
}