#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 *);
char *malloc(int);
int remove(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int strlen(char *);
int moddate_remove(char *folder) {
  int len = strlen(folder) + 2 + strlen(".moddate");
  char *temp = malloc(len);
  if (temp != NULL) {
    snprintf(temp, len, "%s/%s", folder, ".moddate");
    int res = remove(temp);
    free(temp);
    return res == 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<moddate_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
lea    0xe8e(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11df <moddate_remove+0x8f>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xe5f(%rip),%rdx
lea    0xe4f(%rip),%r8
call   1060 <snprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <remove@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <moddate_remove+0x96>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moddate_remove>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%ebx
lea    0xe9b(%rip),%rdi
call   1050 <strlen@plt>
lea    (%rbx,%rax,1),%ebp
add    $0x2,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11b5 <moddate_remove+0x65>
mov    %rax,%rbx
lea    0xe83(%rip),%rdx
lea    0xe73(%rip),%r8
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r14,%rcx
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <remove@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
jmp    11b7 <moddate_remove+0x67>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c".moddate\00"
@.str.1 = [6 x i8] c"%s/%s\00"
define i32 @moddate_remove(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = add nsw i32 %8, 2
%10 = call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = add nsw i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %28
16: ; preds = %1
%17 = load i8*, i8** %5
%18 = load i32, i32* %4
%19 = load i8*, i8** %3
%20 = call i32 @snprintf(i8* %17, i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %5
%22 = call i32 @remove(i8* %21)
store i32 %22, i32* %6
%23 = load i8*, i8** %5
%24 = call i32 @free(i8* %23)
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i32
store i32 %27, i32* %2
br label %29
28: ; preds = %1
store i32 0, i32* %2
br label %29
29: ; preds = %28, %16
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@.str = [9 x i8] c".moddate\00"
@.str.1 = [6 x i8] c"%s/%s\00"
define i32 @moddate_remove(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 2
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = add nsw i32 %3, %4
%6 = tail call i8* @malloc(i32 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %14, label %8
8: ; preds = %1
%9 = tail call i32 @snprintf(i8* %6, i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @remove(i8* %6)
%11 = tail call i32 @free(i8* %6)
%12 = icmp eq i32 %10, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %1, %8
%15 = phi i32 [ %13, %8 ], [ 0, %1 ]
ret i32 %15
}