#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*/ assert(int);
scalar_t__ check();
int /*<<< orphan*/ doit(int);
int mkstemp(char *);
int /*<<< orphan*/ test_bcmp();
int /*<<< orphan*/ test_memcmp();
int /*<<< orphan*/ unlink(char *);
int main() {
  char template[] = "/tmp/dummyXXXXXX";
  int fd;
  char *c;
  size_t i;
  assert(fd = mkstemp(template));
  unlink(template);
  doit(fd);
  assert(check() == 0);
  test_bcmp();
  test_memcmp();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe75(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <mkstemp@plt>
mov    %eax,%edi
mov    %edi,-0x24(%rbp)
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x24(%rbp),%edi
call   1060 <doit@plt>
mov    $0x0,%al
call   1080 <check@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1040 <test_bcmp@plt>
mov    $0x0,%al
call   1090 <test_memcmp@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movaps 0xe83(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <mkstemp@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    %ebp,%edi
call   1060 <doit@plt>
xor    %eax,%eax
call   1080 <check@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1040 <test_bcmp@plt>
xor    %eax,%eax
call   1090 <test_memcmp@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.template = [17 x i8] c"/tmp/dummyXXXXXX\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 0, i32* %1
%6 = bitcast [17 x i8]* %2 to i8*
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%8 = call i32 @mkstemp(i8* %7)
store i32 %8, i32* %3
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%11 = call i32 @unlink(i8* %10)
%12 = load i32, i32* %3
%13 = call i32 @doit(i32 %12)
%14 = call i64 (...) @check()
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 (...) @test_bcmp()
%19 = call i32 (...) @test_memcmp()
ret i32 0
}

LLVM IR (-O2):
@__const.main.template = [17 x i8] c"/tmp/dummyXXXXXX\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%3 = call i32 @mkstemp(i8* %2)
%4 = call i32 @assert(i32 %3)
%5 = call i32 @unlink(i8* %2)
%6 = call i32 @doit(i32 %3)
%7 = call i64 (...) @check()
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 (...) @test_bcmp()
%12 = call i32 (...) @test_memcmp()
ret i32 0
}