#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int system(char *);
int main() {
  int i;
  printf("Checking if processor is available...");
  if (system(NULL))
    puts("Ok");
  else
    exit(EXIT_FAILURE);
  printf("Executing command DIR...\n");
  i = system("dir");
  i = system("gcc system.c");
  printf("The value returned was: %d.\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <system@plt>
cmp    $0x0,%eax
je     1180 <main+0x40>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <main+0x4e>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x8(%rbp)
lea    0xe95(%rip),%rdi
call   1040 <system@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1040 <system@plt>
test   %eax,%eax
je     119e <main+0x5e>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1040 <system@plt>
lea    0xea8(%rip),%rdi
call   1040 <system@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Checking if processor is available...\00"
@.str.1 = [3 x i8] c"Ok\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [26 x i8] c"Executing command DIR...\0A\00"
@.str.3 = [4 x i8] c"dir\00"
@.str.4 = [13 x i8] c"gcc system.c\00"
@.str.5 = [29 x i8] c"The value returned was: %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @system(i8* null)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %11
8: ; preds = %0
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 %13, i32* %2
%14 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Checking if processor is available...\00"
@.str.1 = [3 x i8] c"Ok\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [4 x i8] c"dir\00"
@.str.4 = [13 x i8] c"gcc system.c\00"
@.str.5 = [29 x i8] c"The value returned was: %d.\0A\00"
@str = [25 x i8] c"Executing command DIR...\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* null)
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %8)
ret i32 0
10: ; preds = %0
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
}