#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 */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IXUSR;
int chmod(char const *, int);
int /*<<< orphan*/ lt_debugprintf(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ nonempty(char const *);
scalar_t__ stat(char const *, struct stat *);
int make_executable(const char *path) {
  int rval = 0;
  struct stat st;
  lt_debugprintf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/repstd/modified_vlc/refs/"
                 "heads/master/bin/.libs/lt-vlc-static.c",
                 384, "(make_executable): %s\n", nonempty(path));
  if ((!path) || (!*path))
    return 0;
  if (stat(path, &st) >= 0) {
    rval = chmod(path, st.st_mode | 0 | 0 | S_IXUSR);
  }
  return rval;
}


x86 assembly (clang, -O0):
<make_executable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <nonempty@plt>
mov    %eax,%ecx
lea    0xe9b(%rip),%rdi
mov    $0x180,%esi
lea    0xf29(%rip),%rdx
call   1060 <lt_debugprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     118e <make_executable+0x4e>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    119a <make_executable+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11d5 <make_executable+0x95>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jl     11cf <make_executable+0x8f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
or     $0x0,%esi
or     $0x0,%esi
mov    0x2e23(%rip),%rax
or     (%rax),%esi
call   1050 <chmod@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_executable>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <nonempty@plt>
lea    0xeae(%rip),%rdi
lea    0xf41(%rip),%rdx
mov    $0x180,%esi
mov    %eax,%ecx
call   1060 <lt_debugprintf@plt>
xor    %ebp,%ebp
test   %rbx,%rbx
je     1197 <make_executable+0x57>
cmpb   $0x0,(%rbx)
je     1197 <make_executable+0x57>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <stat@plt>
test   %rax,%rax
js     1197 <make_executable+0x57>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
or     (%rsp),%esi
mov    %rbx,%rdi
call   1050 <chmod@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/repstd/modified_vlc/refs/heads/master/bin/.libs/lt-vlc-static.c\00"
@.str.1 = [23 x i8] c"(make_executable): %s\0A\00"
@S_IXUSR = global i32 0
define i32 @make_executable(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.stat
store i8* %0, i8** %3
store i32 0, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @nonempty(i8* %6)
%8 = call i32 @lt_debugprintf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 384, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11, %1
store i32 0, i32* %2
br label %31
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i64 @stat(i8* %17, %struct.stat* %5)
%19 = icmp sge i64 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%23 = load i32, i32* %22
%24 = or i32 %23, 0
%25 = or i32 %24, 0
%26 = load i32, i32* @S_IXUSR
%27 = or i32 %25, %26
%28 = call i32 @chmod(i8* %21, i32 %27)
store i32 %28, i32* %4
br label %29
29: ; preds = %20, %16
%30 = load i32, i32* %4
store i32 %30, i32* %2
br label %31
31: ; preds = %29, %15
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/repstd/modified_vlc/refs/heads/master/bin/.libs/lt-vlc-static.c\00"
@.str.1 = [23 x i8] c"(make_executable): %s\0A\00"
@S_IXUSR = global i32 0
define i32 @make_executable(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = tail call i32 @nonempty(i8* %0)
%5 = tail call i32 @lt_debugprintf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i32 384, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = icmp eq i8* %0, null
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %7
%11 = call i64 @stat(i8* %0, %struct.stat* %2)
%12 = icmp sgt i64 %11, -1
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%15 = load i32, i32* %14
%16 = load i32, i32* @S_IXUSR
%17 = or i32 %16, %15
%18 = call i32 @chmod(i8* %0, i32 %17)
br label %19
19: ; preds = %10, %13, %1, %7
%20 = phi i32 [ 0, %7 ], [ 0, %1 ], [ %18, %13 ], [ 0, %10 ]
ret i32 %20
}