#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 */
size_t abs(char);
int /*<<< orphan*/ asprintf(char **, char *, char *, char *);
int /*<<< orphan*/ exec_command(char *);
int generic_cmd(char *params[]) {
  char cmd[] = "%s %s";
  char *gen_cmd;
  asprintf(&gen_cmd, cmd, params[abs('a' - "'g'"[1])],
           params[abs('a' - "'r'"[1])]);
  exec_command(gen_cmd);
  return 0;
}


x86 assembly (clang, -O0):
<generic_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xeb8(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
movsbl 0xea0(%rip),%ecx
mov    $0x61,%eax
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsbl 0xe77(%rip),%ecx
mov    $0x61,%eax
sub    %ecx,%eax
movsbl %al,%edi
call   1030 <abs@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    (%rax,%rcx,8),%rcx
lea    -0x18(%rbp),%rdi
call   1050 <asprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <exec_command@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_cmd>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movw   $0x73,0xc(%rsp)
movl   $0x25207325,0x8(%rsp)
25
mov    $0xfffffffa,%edi
call   1030 <abs@plt>
mov    (%rbx,%rax,8),%r14
mov    $0xffffffef,%edi
call   1030 <abs@plt>
mov    (%rbx,%rax,8),%rcx
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %r14,%rdx
call   1050 <asprintf@plt>
mov    0x10(%rsp),%rdi
call   1040 <exec_command@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.generic_cmd.cmd = [6 x i8] c"%s %s\00"
@.str = [4 x i8] c"'g'\00"
@.str.1 = [4 x i8] c"'r'\00"
define i32 @generic_cmd(i8** %0) {
%2 = alloca i8**
%3 = alloca [6 x i8]
%4 = alloca i8*
store i8** %0, i8*** %2
%5 = bitcast [6 x i8]* %3 to i8*
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = load i8**, i8*** %2
%8 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 1)
%9 = sext i8 %8 to i32
%10 = sub nsw i32 97, %9
%11 = trunc i32 %10 to i8
%12 = call i64 @abs(i8 signext %11)
%13 = getelementptr inbounds i8*, i8** %7, i64 %12
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %2
%16 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 1)
%17 = sext i8 %16 to i32
%18 = sub nsw i32 97, %17
%19 = trunc i32 %18 to i8
%20 = call i64 @abs(i8 signext %19)
%21 = getelementptr inbounds i8*, i8** %15, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @asprintf(i8** %4, i8* %6, i8* %14, i8* %22)
%24 = load i8*, i8** %4
%25 = call i32 @exec_command(i8* %24)
ret i32 0
}

LLVM IR (-O2):
@__const.generic_cmd.cmd = [6 x i8] c"%s %s\00"
define i32 @generic_cmd(i8** nocapture %0) {
%2 = alloca [6 x i8]
%3 = alloca i8*
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = bitcast i8** %3 to i8*
%6 = tail call i64 @abs(i8 signext -6)
%7 = getelementptr inbounds i8*, i8** %0, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i64 @abs(i8 signext -17)
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = call i32 @asprintf(i8** %3, i8* %4, i8* %8, i8* %11)
%13 = load i8*, i8** %3
%14 = call i32 @exec_command(i8* %13)
ret i32 0
}