#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(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ help();
scalar_t__ isFiles(char *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
int /*<<< orphan*/ system(char *);
int main(int arg, char *argv[]) {
  int success = -1;
  if (arg != 3) {
    help();
  } else {
    if (isFiles(argv[1], argv[2])) {
      char *bufferA = (char *)malloc((strlen(argv[1]) + 40) * sizeof(char));
      char *bufferB = (char *)malloc((strlen(argv[2]) + 40) * sizeof(char));
      char bufferDiff[] = "diff -y /tmp/fileDiffB /tmp/fileDiffA";
      if (bufferA == NULL || bufferB == NULL) {
        perror("Error to reserve memory");
        exit(-1);
      }
      sprintf(bufferA, "xxd %s > /tmp/fileDiffA", argv[1]);
      sprintf(bufferB, "xxd %s > /tmp/fileDiffB", argv[2]);
      system(bufferA);
      system(bufferB);
      system(bufferDiff);
      success = 0;
      system("rm /tmp/fileDiffA");
      system("rm /tmp/fileDiffB");
      free(bufferA);
      free(bufferB);
    }
  }
  return success;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11d3 <main+0x33>
mov    $0x0,%al
call   10a0 <help@plt>
jmp    12f6 <main+0x156>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1060 <isFiles@plt>
cmp    $0x0,%rax
je     12f1 <main+0x151>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
add    $0x28,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
add    $0x28,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xdc1(%rip),%rsi
mov    $0x26,%edx
call   1070 <memcpy@plt>
cmpq   $0x0,-0x20(%rbp)
je     125f <main+0xbf>
cmpq   $0x0,-0x28(%rbp)
jne    1275 <main+0xd5>
lea    0xdc0(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdb6(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdb6(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <system@plt>
mov    -0x28(%rbp),%rdi
call   1050 <system@plt>
lea    -0x50(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x14(%rbp)
lea    0xda0(%rip),%rdi
call   1050 <system@plt>
lea    0xda6(%rip),%rdi
call   1050 <system@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    12f6 <main+0x156>
mov    -0x14(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
cmp    $0x3,%edi
jne    1285 <main+0xf5>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1060 <isFiles@plt>
test   %rax,%rax
je     128c <main+0xfc>
mov    0x8(%rbx),%rdi
call   1040 <strlen@plt>
lea    0x28(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1040 <strlen@plt>
lea    0x28(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%r15
movaps 0xe26(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe0a(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x4166666944656c,%rax
mov    %rax,0x1e(%rsp)
test   %r14,%r14
je     129b <main+0x10b>
test   %r15,%r15
je     129b <main+0x10b>
mov    0x8(%rbx),%rdx
lea    0xe18(%rip),%rsi
mov    %r14,%rdi
call   10a0 <sprintf@plt>
mov    0x10(%rbx),%rdx
lea    0xe1d(%rip),%rsi
mov    %r15,%rdi
call   10a0 <sprintf@plt>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %r15,%rdi
call   1050 <system@plt>
mov    %rsp,%rdi
call   1050 <system@plt>
lea    0xe0e(%rip),%rdi
call   1050 <system@plt>
lea    0xe14(%rip),%rdi
call   1050 <system@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    1291 <main+0x101>
xor    %eax,%eax
call   1090 <help@plt>
mov    $0xffffffff,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xd84(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@__const.main.bufferDiff = [38 x i8] c"diff -y /tmp/fileDiffB /tmp/fileDiffA\00"
@.str = [24 x i8] c"Error to reserve memory\00"
@.str.1 = [24 x i8] c"xxd %s > /tmp/fileDiffA\00"
@.str.2 = [24 x i8] c"xxd %s > /tmp/fileDiffB\00"
@.str.3 = [18 x i8] c"rm /tmp/fileDiffA\00"
@.str.4 = [18 x i8] c"rm /tmp/fileDiffB\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [38 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @help()
br label %77
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i64 @isFiles(i8* %17, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %76
23: ; preds = %14
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strlen(i8* %26)
%28 = add nsw i32 %27, 40
%29 = sext i32 %28 to i64
%30 = mul i64 %29, 1
%31 = trunc i64 %30 to i32
%32 = call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to i8*
store i8* %33, i8** %7
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
%38 = add nsw i32 %37, 40
%39 = sext i32 %38 to i64
%40 = mul i64 %39, 1
%41 = trunc i64 %40 to i32
%42 = call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to i8*
store i8* %43, i8** %8
%44 = bitcast [38 x i8]* %9 to i8*
%45 = load i8*, i8** %7
%46 = icmp eq i8* %45, null
br i1 %46, label %50, label %47
47: ; preds = %23
%48 = load i8*, i8** %8
%49 = icmp eq i8* %48, null
br i1 %49, label %50, label %53
50: ; preds = %47, %23
%51 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%52 = call i32 @exit(i32 -1)
unreachable
53: ; preds = %47
%54 = load i8*, i8** %7
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i32 @sprintf(i8* %54, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %57)
%59 = load i8*, i8** %8
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %62)
%64 = load i8*, i8** %7
%65 = call i32 @system(i8* %64)
%66 = load i8*, i8** %8
%67 = call i32 @system(i8* %66)
%68 = getelementptr inbounds [38 x i8], [38 x i8]* %9, i64 0, i64 0
%69 = call i32 @system(i8* %68)
store i32 0, i32* %6
%70 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%71 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%72 = load i8*, i8** %7
%73 = call i32 @free(i8* %72)
%74 = load i8*, i8** %8
%75 = call i32 @free(i8* %74)
br label %76
76: ; preds = %53, %14
br label %77
77: ; preds = %76, %12
%78 = load i32, i32* %6
ret i32 %78
}

LLVM IR (-O2):
@__const.main.bufferDiff = [38 x i8] c"diff -y /tmp/fileDiffB /tmp/fileDiffA\00"
@.str = [24 x i8] c"Error to reserve memory\00"
@.str.1 = [24 x i8] c"xxd %s > /tmp/fileDiffA\00"
@.str.2 = [24 x i8] c"xxd %s > /tmp/fileDiffB\00"
@.str.3 = [18 x i8] c"rm /tmp/fileDiffA\00"
@.str.4 = [18 x i8] c"rm /tmp/fileDiffB\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [38 x i8]
%4 = icmp eq i32 %0, 3
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @help()
br label %44
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @isFiles(i8* %9, i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %44, label %14
14: ; preds = %7
%15 = load i8*, i8** %8
%16 = tail call i32 @strlen(i8* %15)
%17 = add nsw i32 %16, 40
%18 = tail call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i8*
%20 = load i8*, i8** %10
%21 = tail call i32 @strlen(i8* %20)
%22 = add nsw i32 %21, 40
%23 = tail call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
%25 = getelementptr inbounds [38 x i8], [38 x i8]* %3, i64 0, i64 0
%26 = icmp eq i64 %18, 0
%27 = icmp eq i64 %23, 0
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %29, label %32
29: ; preds = %14
%30 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%31 = tail call i32 @exit(i32 -1)
unreachable
32: ; preds = %14
%33 = load i8*, i8** %8
%34 = tail call i32 @sprintf(i8* dereferenceable(1) %19, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %10
%36 = tail call i32 @sprintf(i8* dereferenceable(1) %24, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = tail call i32 @system(i8* %19)
%38 = tail call i32 @system(i8* %24)
%39 = call i32 @system(i8* %25)
%40 = tail call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%41 = tail call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%42 = tail call i32 @free(i8* %19)
%43 = tail call i32 @free(i8* %24)
br label %44
44: ; preds = %7, %32, %5
%45 = phi i32 [ -1, %5 ], [ 0, %32 ], [ -1, %7 ]
ret i32 %45
}