#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*/ bytesToString(unsigned char *, int, char *);
int /*<<< orphan*/ stringToBytes(char *, unsigned char *);
int strlen(char *);
void modifyCdeForMac(char *command, char *mCommand) {
  int i, t_bytes_cde = strlen(command) / 2;
  unsigned char bytes_cde[260], bytes_mCde[260];
  stringToBytes(command, bytes_cde);
  for (i = 0; i < t_bytes_cde; i++)
    bytes_mCde[i] = bytes_cde[i];
  bytes_mCde[0] = bytes_cde[0] | 0x04;
  bytes_mCde[4] = bytes_cde[4] + 0x08;
  bytesToString(bytes_mCde, t_bytes_cde, mCommand);
}


x86 assembly (clang, -O0):
<modifyCdeForMac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1050 <stringToBytes@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    119e <modifyCdeForMac+0x6e>
movslq -0x14(%rbp),%rax
mov    -0x120(%rbp,%rax,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x230(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <modifyCdeForMac+0x3e>
movzbl -0x120(%rbp),%eax
or     $0x4,%eax
mov    %al,-0x230(%rbp)
movzbl -0x11c(%rbp),%eax
add    $0x8,%eax
mov    %al,-0x22c(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <bytesToString@plt>
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modifyCdeForMac>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
lea    0x110(%rsp),%rsi
mov    %r15,%rdi
call   1060 <stringToBytes@plt>
cmp    $0x2,%ebp
jl     118f <modifyCdeForMac+0x4f>
lea    -0x1(%rbx),%edx
add    $0x1,%rdx
mov    %rsp,%rdi
lea    0x110(%rsp),%rsi
call   1050 <memcpy@plt>
mov    0x110(%rsp),%al
mov    0x114(%rsp),%cl
or     $0x4,%al
mov    %al,(%rsp)
add    $0x8,%cl
mov    %cl,0x4(%rsp)
mov    %rsp,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1040 <bytesToString@plt>
add    $0x218,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @modifyCdeForMac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [260 x i8]
%8 = alloca [260 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = sdiv i32 %10, 2
store i32 %11, i32* %6
%12 = load i8*, i8** %3
%13 = getelementptr inbounds [260 x i8], [260 x i8]* %7, i64 0, i64 0
%14 = call i32 @stringToBytes(i8* %12, i8* %13)
store i32 0, i32* %5
br label %15
15: ; preds = %27, %2
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [260 x i8], [260 x i8]* %7, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [260 x i8], [260 x i8]* %8, i64 0, i64 %25
store i8 %23, i8* %26
br label %27
27: ; preds = %19
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %15
30: ; preds = %15
%31 = getelementptr inbounds [260 x i8], [260 x i8]* %7, i64 0, i64 0
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = or i32 %33, 4
%35 = trunc i32 %34 to i8
%36 = getelementptr inbounds [260 x i8], [260 x i8]* %8, i64 0, i64 0
store i8 %35, i8* %36
%37 = getelementptr inbounds [260 x i8], [260 x i8]* %7, i64 0, i64 4
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = add nsw i32 %39, 8
%41 = trunc i32 %40 to i8
%42 = getelementptr inbounds [260 x i8], [260 x i8]* %8, i64 0, i64 4
store i8 %41, i8* %42
%43 = getelementptr inbounds [260 x i8], [260 x i8]* %8, i64 0, i64 0
%44 = load i32, i32* %6
%45 = load i8*, i8** %4
%46 = call i32 @bytesToString(i8* %43, i32 %44, i8* %45)
ret void
}

LLVM IR (-O2):
define void @modifyCdeForMac(i8* %0, i8* %1) {
%3 = alloca [260 x i8]
%4 = alloca [260 x i8]
%5 = tail call i32 @strlen(i8* %0)
%6 = sdiv i32 %5, 2
%7 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [260 x i8], [260 x i8]* %4, i64 0, i64 0
%9 = call i32 @stringToBytes(i8* %0, i8* %7)
%10 = icmp sgt i32 %5, 1
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = getelementptr inbounds [260 x i8], [260 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 0
%14 = add nsw i32 %6, -1
%15 = zext i32 %14 to i64
%16 = add nuw nsw i64 %15, 1
br label %17
17: ; preds = %11, %2
%18 = load i8, i8* %7
%19 = or i8 %18, 4
store i8 %19, i8* %8
%20 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 4
%21 = load i8, i8* %20
%22 = add i8 %21, 8
%23 = getelementptr inbounds [260 x i8], [260 x i8]* %4, i64 0, i64 4
store i8 %22, i8* %23
%24 = call i32 @bytesToString(i8* %8, i32 %6, i8* %1)
ret void
}