#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 */
typedef int /*<<< orphan*/ file;
typedef int /*<<< orphan*/ dir;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ temp_file_name(int, char *, char *);
int /*<<< orphan*/ unlink(char *);
void close_temp_file(int type, FILE *fp) {
  char file[1024];
  char dir[1024];
  fclose(fp);
  memset(&dir, 0, sizeof(dir));
  memset(&file, 0, sizeof(file));
  temp_file_name(type, dir, file);
  unlink(file);
  return;
}


x86 assembly (clang, -O0):
<close_temp_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x810(%rbp),%rsi
lea    -0x410(%rbp),%rdx
call   1060 <temp_file_name@plt>
lea    -0x410(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_temp_file>:
push   %rbp
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <fclose@plt>
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <temp_file_name@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @close_temp_file(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = call i32 @fclose(i32* %7)
%9 = bitcast [1024 x i8]* %6 to i8**
%10 = call i32 @memset(i8** %9, i32 0, i32 1024)
%11 = bitcast [1024 x i8]* %5 to i8**
%12 = call i32 @memset(i8** %11, i32 0, i32 1024)
%13 = load i32, i32* %3
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%16 = call i32 @temp_file_name(i32 %13, i8* %14, i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%18 = call i32 @unlink(i8* %17)
ret void
}

LLVM IR (-O2):
define void @close_temp_file(i32 %0, i32* nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @fclose(i32* %1)
%8 = bitcast [1024 x i8]* %4 to i8**
%9 = call i32 @memset(i8** %8, i32 0, i32 1024)
%10 = bitcast [1024 x i8]* %3 to i8**
%11 = call i32 @memset(i8** %10, i32 0, i32 1024)
%12 = call i32 @temp_file_name(i32 %0, i8* %6, i8* %5)
%13 = call i32 @unlink(i8* %5)
ret void
}