#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 fabs(int);
int /*<<< orphan*/ printf(char *, ...);
int sin(char);
int strlen(char *);
void cript(char msg[30]) {
  int i, aux;
  if (strlen(msg) % 2 == 0) {
    printf("String par!\n");
    for (i = 0; i < strlen(msg) / 2; i++) {
      aux = fabs(((sin(msg[i]) * 254)));
      printf("aux[%d]: %d\n", i, aux);
      msg[i] = aux;
    }
  } else {
    printf("String impar!\n");
    for (i = 0; i < strlen(msg) + 1 / 2; i++) {
      aux = fabs(((sin(msg[i]) * 254)));
      printf("aux[%d]: %d\n", i, aux);
      msg[i] = aux;
    }
  }
  printf("%s\n", msg);
}


x86 assembly (clang, -O0):
<cript>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f7 <cript+0xb7>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11f2 <cript+0xb2>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%edi
call   1060 <sin@plt>
imul   $0xfe,%eax,%edi
call   1050 <fabs@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <cript+0x3b>
jmp    1283 <cript+0x143>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    $0x0,%ecx
cmp    %ecx,%eax
jge    127e <cript+0x13e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%edi
call   1060 <sin@plt>
imul   $0xfe,%eax,%edi
call   1050 <fabs@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    120c <cript+0xcc>
jmp    1283 <cript+0x143>
mov    -0x8(%rbp),%rsi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cript>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1040 <strlen@plt>
test   $0x1,%al
jne    11db <cript+0x8b>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     123f <cript+0xef>
lea    0xe79(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r15,%rbx,1),%edi
call   1070 <sin@plt>
mov    %eax,%edi
shl    $0x8,%edi
sub    %eax,%edi
sub    %eax,%edi
call   1060 <fabs@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %bpl,(%r15,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
cmp    %rax,%rbx
jl     1190 <cript+0x40>
jmp    123f <cript+0xef>
lea    0xe2b(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    123f <cript+0xef>
lea    0xe06(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r15,%rbx,1),%edi
call   1070 <sin@plt>
mov    %eax,%edi
shl    $0x8,%edi
sub    %eax,%edi
sub    %eax,%edi
call   1060 <fabs@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %bpl,(%r15,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1200 <cript+0xb0>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"String par!\0A\00"
@.str.1 = [13 x i8] c"aux[%d]: %d\0A\00"
@.str.2 = [15 x i8] c"String impar!\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @cript(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = srem i32 %6, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %39
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %11
11: ; preds = %35, %9
%12 = load i32, i32* %3
%13 = load i8*, i8** %2
%14 = call i32 @strlen(i8* %13)
%15 = sdiv i32 %14, 2
%16 = icmp slt i32 %12, %15
br i1 %16, label %17, label %38
17: ; preds = %11
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @sin(i8 signext %22)
%24 = mul nsw i32 %23, 254
%25 = call i32 @fabs(i32 %24)
store i32 %25, i32* %4
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* %4
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %2
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 %30, i8* %34
br label %35
35: ; preds = %17
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %11
38: ; preds = %11
br label %69
39: ; preds = %1
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %41
41: ; preds = %65, %39
%42 = load i32, i32* %3
%43 = load i8*, i8** %2
%44 = call i32 @strlen(i8* %43)
%45 = add nsw i32 %44, 0
%46 = icmp slt i32 %42, %45
br i1 %46, label %47, label %68
47: ; preds = %41
%48 = load i8*, i8** %2
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = call i32 @sin(i8 signext %52)
%54 = mul nsw i32 %53, 254
%55 = call i32 @fabs(i32 %54)
store i32 %55, i32* %4
%56 = load i32, i32* %3
%57 = load i32, i32* %4
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %56, i32 %57)
%59 = load i32, i32* %4
%60 = trunc i32 %59 to i8
%61 = load i8*, i8** %2
%62 = load i32, i32* %3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
store i8 %60, i8* %64
br label %65
65: ; preds = %47
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %41
68: ; preds = %41
br label %69
69: ; preds = %68, %38
%70 = load i8*, i8** %2
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %70)
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"aux[%d]: %d\0A\00"
@str = [14 x i8] c"String impar!\00"
@str.4 = [12 x i8] c"String par!\00"
define void @cript(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %24
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %42
9: ; preds = %5, %9
%10 = phi i64 [ %19, %9 ], [ 0, %5 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 @sin(i8 signext %12)
%14 = mul nsw i32 %13, 254
%15 = tail call i32 @fabs(i32 %14)
%16 = trunc i64 %10 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %15)
%18 = trunc i32 %15 to i8
store i8 %18, i8* %11
%19 = add nuw nsw i64 %10, 1
%20 = tail call i32 @strlen(i8* %0)
%21 = sdiv i32 %20, 2
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %19, %22
br i1 %23, label %9, label %42
24: ; preds = %1
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%26 = tail call i32 @strlen(i8* %0)
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %24, %28
%29 = phi i64 [ %38, %28 ], [ 0, %24 ]
%30 = getelementptr inbounds i8, i8* %0, i64 %29
%31 = load i8, i8* %30
%32 = tail call i32 @sin(i8 signext %31)
%33 = mul nsw i32 %32, 254
%34 = tail call i32 @fabs(i32 %33)
%35 = trunc i64 %29 to i32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %34)
%37 = trunc i32 %34 to i8
store i8 %37, i8* %30
%38 = add nuw nsw i64 %29, 1
%39 = tail call i32 @strlen(i8* %0)
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %28, label %42
42: ; preds = %28, %9, %24, %5
%43 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}