#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*/ printf(char *);
int system(char *);
int main() {
  int i;
  int hwCheck;
  hwCheck = system("grep 00000000367e0dc8 /proc/cpuinfo > /dev/null");
  if (hwCheck)
    goto error;
  for (i = 0; i < 4; i++) {
    system("calc/calc.py >> reading.val");
  }
  system("errorCheck/errorCheck.py > res");
  system("csv/csv.py >> data.csv");
  system("rm reading.val");
  return 0;
error:
  printf("HW verification fails, check system provider\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114d <main+0x2d>
jmp    11a8 <main+0x88>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1178 <main+0x58>
lea    0xecb(%rip),%rdi
call   1030 <system@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
lea    0xecd(%rip),%rdi
call   1030 <system@plt>
lea    0xee0(%rip),%rdi
call   1030 <system@plt>
lea    0xeeb(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <main+0x94>
lea    0xee2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <system@plt>
test   %eax,%eax
je     113f <main+0x1f>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
jmp    118a <main+0x6a>
lea    0xeea(%rip),%rbx
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xedf(%rip),%rdi
call   1040 <system@plt>
lea    0xef2(%rip),%rdi
call   1040 <system@plt>
lea    0xefd(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"grep 00000000367e0dc8 /proc/cpuinfo > /dev/null\00"
@.str.1 = [28 x i8] c"calc/calc.py >> reading.val\00"
@.str.2 = [31 x i8] c"errorCheck/errorCheck.py > res\00"
@.str.3 = [23 x i8] c"csv/csv.py >> data.csv\00"
@.str.4 = [15 x i8] c"rm reading.val\00"
@.str.5 = [46 x i8] c"HW verification fails, check system provider\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @system(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %21
8: ; preds = %0
store i32 0, i32* %2
br label %9
9: ; preds = %14, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %9
17: ; preds = %9
%18 = call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %23
21: ; preds = %7
%22 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [48 x i8] c"grep 00000000367e0dc8 /proc/cpuinfo > /dev/null\00"
@.str.1 = [28 x i8] c"calc/calc.py >> reading.val\00"
@.str.2 = [31 x i8] c"errorCheck/errorCheck.py > res\00"
@.str.3 = [23 x i8] c"csv/csv.py >> data.csv\00"
@.str.4 = [15 x i8] c"rm reading.val\00"
@str = [45 x i8] c"HW verification fails, check system provider\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %11
3: ; preds = %0
%4 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @system(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %3
ret i32 0
}