#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*/ _do_log(char *, int, char *, ...);
int /*<<< orphan*/ system(char *);
bool execute_buffer(char *buffer) {
  do {
    if (!(buffer)) {
      _do_log("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/itmm/waelzer/refs/heads/master/"
              "4.2-copy-files/execute_buffer.c",
              5,
              ""
              "no buffer");
      return false;
    }
  } while (false);
  do {
    if (!(!system(buffer))) {
      _do_log("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/itmm/waelzer/refs/heads/master/"
              "4.2-copy-files/execute_buffer.c",
              6,
              ""
              "can't execute '%s'",
              buffer);
      return false;
    }
  } while (false);
  return true;
}


x86 assembly (clang, -O0):
<execute_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <execute_buffer+0x3d>
lea    0xec2(%rip),%rdi
mov    $0x5,%esi
lea    0xf4f(%rip),%rdx
mov    $0x0,%al
call   1040 <_do_log@plt>
movl   $0x0,-0x4(%rbp)
jmp    11af <execute_buffer+0x8f>
jmp    1162 <execute_buffer+0x42>
jmp    1167 <execute_buffer+0x47>
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%eax
je     11a3 <execute_buffer+0x83>
mov    -0x10(%rbp),%rcx
lea    0xe7c(%rip),%rdi
mov    $0x6,%esi
lea    0xf13(%rip),%rdx
mov    $0x0,%al
call   1040 <_do_log@plt>
movl   $0x0,-0x4(%rbp)
jmp    11af <execute_buffer+0x8f>
jmp    11a8 <execute_buffer+0x88>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_buffer>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1155 <execute_buffer+0x35>
mov    %rdi,%rbx
call   1030 <system@plt>
test   %eax,%eax
je     1173 <execute_buffer+0x53>
lea    0xec5(%rip),%rdi
lea    0xf61(%rip),%rdx
xor    %ebp,%ebp
mov    $0x6,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <_do_log@plt>
jmp    1178 <execute_buffer+0x58>
lea    0xea4(%rip),%rdi
lea    0xf36(%rip),%rdx
xor    %ebp,%ebp
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <_do_log@plt>
jmp    1178 <execute_buffer+0x58>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/itmm/waelzer/refs/heads/master/4.2-copy-files/execute_buffer.c\00"
@.str.1 = [10 x i8] c"no buffer\00"
@.str.2 = [19 x i8] c"can't execute '%s'\00"
define i32 @execute_buffer(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %1
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = call i32 (i8*, i32, i8*, ...) @_do_log(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %20
9: ; preds = %4
br label %10
10: ; preds = %9
br label %11
11: ; preds = %10
%12 = load i8*, i8** %3
%13 = call i32 @system(i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 (i8*, i32, i8*, ...) @_do_log(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %16)
store i32 0, i32* %2
br label %20
18: ; preds = %11
br label %19
19: ; preds = %18
store i32 1, i32* %2
br label %20
20: ; preds = %19, %15, %7
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/itmm/waelzer/refs/heads/master/4.2-copy-files/execute_buffer.c\00"
@.str.1 = [10 x i8] c"no buffer\00"
@.str.2 = [19 x i8] c"can't execute '%s'\00"
define i32 @execute_buffer(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, i32, i8*, ...) @_do_log(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %10
5: ; preds = %1
%6 = tail call i32 @system(i8* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (i8*, i32, i8*, ...) @_do_log(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %5, %8, %3
%11 = phi i32 [ 0, %8 ], [ 0, %3 ], [ 1, %5 ]
ret i32 %11
}