#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 /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int system(char *);
int main(int argc, char *argv[]) {
  char cmd[50];
  int ret;
  if (argc == 3) {
    sprintf(cmd, "rev %s>%s", argv[1], argv[2]);
    ret = system(cmd);
    if (ret == 0)
      printf("Success Source: %s Destination: %s\n", argv[1], argv[2]);
  } else
    printf("Invalid Command\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11a9 <main+0x79>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xe95(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    11a4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b7 <main+0x87>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
cmp    $0x3,%edi
jne    118d <main+0x4d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdx
mov    0x10(%rsi),%rcx
lea    0xea2(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1040 <system@plt>
test   %eax,%eax
jne    1199 <main+0x59>
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rdx
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1199 <main+0x59>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"rev %s>%s\00"
@.str.1 = [36 x i8] c"Success Source: %s Destination: %s\0A\00"
@.str.2 = [17 x i8] c"Invalid Command\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [50 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %32
10: ; preds = %2
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%20 = call i32 @system(i8* %19)
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %10
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %26, i8* %29)
br label %31
31: ; preds = %23, %10
br label %34
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"rev %s>%s\00"
@.str.1 = [36 x i8] c"Success Source: %s Destination: %s\0A\00"
@str = [16 x i8] c"Invalid Command\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %18
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %10)
%12 = call i32 @system(i8* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %6
%15 = load i8*, i8** %7
%16 = load i8*, i8** %9
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16)
br label %20
18: ; preds = %2
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %6, %14, %18
ret i32 0
}