#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*/ permAlphaChar(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverseString(char *);
int stringLength(char *);
int main() {
  char rev_msg[] = "Bonjour le monde";
  int rev_length = stringLength(rev_msg);
  char perm_msg[] = "Bonjour a tous et toutes";
  int perm_length = stringLength(perm_msg);
  printf("La chaine de caracteres a inverser est \"%s\" et a pour longueur %d "
         "caractere(s)\n",
         rev_msg, rev_length);
  reverseString(rev_msg);
  printf("La chaine inversee de caracteres est \"%s\"\n", rev_msg);
  printf("\n");
  printf("La chaine de caracteres a permuter est \"%s\" et a pour longueur %d "
         "caractere(s)\n",
         perm_msg, perm_length);
  permAlphaChar(perm_msg, 13);
  printf("La chaine permutee de caracteres est \"%s\"\n", perm_msg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea5(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <stringLength@plt>
mov    %eax,-0x24(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe97(%rip),%al
mov    %al,-0x28(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <stringLength@plt>
mov    %eax,-0x44(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <reverseString@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xd,%esi
call   1040 <permAlphaChar@plt>
lea    -0x40(%rbp),%rsi
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <stringLength@plt>
mov    %eax,%ebp
movups 0xeab(%rip),%xmm0
movups %xmm0,0x29(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1060 <stringLength@plt>
mov    %eax,%r15d
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1070 <reverseString@plt>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xed8(%rip),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0xd,%esi
call   1050 <permAlphaChar@plt>
lea    0xf07(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.rev_msg = [17 x i8] c"Bonjour le monde\00"
@__const.main.perm_msg = [25 x i8] c"Bonjour a tous et toutes\00"
@.str = [80 x i8] c"La chaine de caracteres a inverser est \22%s\22 et a pour longueur %d caractere(s)\0A\00"
@.str.1 = [43 x i8] c"La chaine inversee de caracteres est \22%s\22\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [80 x i8] c"La chaine de caracteres a permuter est \22%s\22 et a pour longueur %d caractere(s)\0A\00"
@.str.4 = [43 x i8] c"La chaine permutee de caracteres est \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca i32
%4 = alloca [25 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [17 x i8]* %2 to i8*
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%8 = call i32 @stringLength(i8* %7)
store i32 %8, i32* %3
%9 = bitcast [25 x i8]* %4 to i8*
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%11 = call i32 @stringLength(i8* %10)
store i32 %11, i32* %5
%12 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13)
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%16 = call i32 @reverseString(i8* %15)
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0), i8* %20, i32 %21)
%23 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%24 = call i32 @permAlphaChar(i8* %23, i32 13)
%25 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %25)
ret i32 0
}

LLVM IR (-O2):
@__const.main.rev_msg = [17 x i8] c"Bonjour le monde\00"
@__const.main.perm_msg = [25 x i8] c"Bonjour a tous et toutes\00"
@.str = [80 x i8] c"La chaine de caracteres a inverser est \22%s\22 et a pour longueur %d caractere(s)\0A\00"
@.str.1 = [43 x i8] c"La chaine inversee de caracteres est \22%s\22\0A\00"
@.str.3 = [80 x i8] c"La chaine de caracteres a permuter est \22%s\22 et a pour longueur %d caractere(s)\0A\00"
@.str.4 = [43 x i8] c"La chaine permutee de caracteres est \22%s\22\0A\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = call i32 @stringLength(i8* %3)
%5 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%6 = call i32 @stringLength(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4)
%8 = call i32 @reverseString(i8* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = call i32 @putchar(i32 10)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32 %6)
%12 = call i32 @permAlphaChar(i8* %5, i32 13)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %5)
ret i32 0
}