#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*/ sprintf(char *, char *, char *, char *);
scalar_t__ system(char *);
int run_command(char *batch_file, char *command) {
  char buffer[4096];
  if (batch_file[0]) {
    sprintf(buffer, "%s && %s", batch_file, command);
    return system(buffer) == 0;
  } else {
    return system(command) == 0;
  }
}


x86 assembly (clang, -O0):
<run_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     117b <run_command+0x5b>
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeaa(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x1020(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <run_command+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <system@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_command>:
push   %rbx
sub    $0x1000,%rsp
mov    %rsi,%rcx
cmpb   $0x0,(%rdi)
je     114a <run_command+0x2a>
mov    %rdi,%rdx
lea    0xec6(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
jmp    114d <run_command+0x2d>
mov    %rcx,%rdi
call   1030 <system@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s && %s\00"
define i32 @run_command(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [4096 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%17 = call i64 @system(i8* %16)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
store i32 %19, i32* %3
br label %25
20: ; preds = %2
%21 = load i8*, i8** %5
%22 = call i64 @system(i8* %21)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
store i32 %24, i32* %3
br label %25
25: ; preds = %20, %11
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s && %s\00"
define i32 @run_command(i8* %0, i8* %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%9 = call i64 @system(i8* %4)
br label %12
10: ; preds = %2
%11 = tail call i64 @system(i8* %1)
br label %12
12: ; preds = %10, %7
%13 = phi i64 [ %9, %7 ], [ %11, %10 ]
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
ret i32 %15
}