#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);
int nuke(char *);
int snprintf(char *, int, char *, char const *, char const *);
int strlen(char const *);
int nuke_dirent(int len, const char *dir, const char *name) {
  int bytes = len + strlen(name) + 2;
  char path[bytes];
  int xlen;
  xlen = snprintf(path, bytes, "%s/%s", dir, name);
  assert(xlen < bytes);
  return nuke(path);
}


x86 assembly (clang, -O0):
<nuke_dirent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%edx
mov    %ecx,%eax
mov    %edx,%ecx
lea    0x2(%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe56(%rip),%rdx
call   1040 <snprintf@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x40(%rbp),%rdi
call   1060 <nuke@plt>
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nuke_dirent>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %edi,%ebx
mov    %rdx,%rdi
call   1030 <strlen@plt>
lea    (%rbx,%rax,1),%r12d
add    $0x2,%r12d
lea    0xf(%r12),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe84(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <snprintf@plt>
xor    %edi,%edi
cmp    %r12d,%eax
setl   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1060 <nuke@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define i32 @nuke_dirent(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i32, i32* %4
%12 = load i8*, i8** %6
%13 = call i32 @strlen(i8* %12)
%14 = add nsw i32 %11, %13
%15 = add nsw i32 %14, 2
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %8
%19 = alloca i8, i64 %17
store i64 %17, i64* %9
%20 = load i32, i32* %7
%21 = load i8*, i8** %5
%22 = load i8*, i8** %6
%23 = call i32 @snprintf(i8* %19, i32 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @nuke(i8* %19)
%30 = load i8*, i8** %8
ret i32 %29
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define i32 @nuke_dirent(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = add i32 %0, 2
%6 = add i32 %5, %4
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = call i32 @snprintf(i8* %8, i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%10 = icmp slt i32 %9, %6
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @nuke(i8* %8)
ret i32 %13
}