#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 strlen(char *);
char *Str_deformate(char *str) {
  int taille = strlen(str);
  for (int i = 0; i < taille; i++) {
    if (str[i] == '$')
      *(str + i) = ' ';
    if (str[i] == '#')
      *(str + i) = '\n';
    if (str[i] == '&')
      *(str + i) = '\t';
  }
  return str;
}


x86 assembly (clang, -O0):
<Str_deformate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b1 <Str_deformate+0xa1>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x24,%eax
jne    115c <Str_deformate+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    117d <Str_deformate+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    119e <Str_deformate+0x8e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x9,(%rax,%rcx,1)
jmp    11a3 <Str_deformate+0x93>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112f <Str_deformate+0x1f>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Str_deformate>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    11cd <Str_deformate+0xbd>
mov    %eax,%esi
cmp    $0x1,%eax
jne    1156 <Str_deformate+0x46>
xor    %eax,%eax
test   $0x1,%sil
je     11cd <Str_deformate+0xbd>
mov    (%rbx,%rax,1),%cl
cmp    $0x23,%cl
je     11c4 <Str_deformate+0xb4>
cmp    $0x24,%cl
je     11c8 <Str_deformate+0xb8>
cmp    $0x26,%cl
jne    11cd <Str_deformate+0xbd>
mov    $0x9,%cl
jmp    11ca <Str_deformate+0xba>
mov    %esi,%edx
and    $0xfffffffe,%edx
xor    %eax,%eax
jmp    116f <Str_deformate+0x5f>
nop
mov    $0xa,%cl
mov    %cl,0x1(%rbx,%rax,1)
add    $0x2,%rax
cmp    %rax,%rdx
je     112a <Str_deformate+0x1a>
movzbl (%rbx,%rax,1),%ecx
cmp    $0x26,%cl
je     1190 <Str_deformate+0x80>
cmp    $0x24,%cl
je     11a0 <Str_deformate+0x90>
cmp    $0x23,%cl
jne    11a5 <Str_deformate+0x95>
mov    $0xa,%cl
jmp    11a2 <Str_deformate+0x92>
cs nopw 0x0(%rax,%rax,1)
mov    $0x9,%cl
jmp    11a2 <Str_deformate+0x92>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%cl
mov    %cl,(%rbx,%rax,1)
movzbl 0x1(%rbx,%rax,1),%ecx
cmp    $0x23,%cl
je     1160 <Str_deformate+0x50>
cmp    $0x24,%cl
je     11c0 <Str_deformate+0xb0>
cmp    $0x26,%cl
jne    1166 <Str_deformate+0x56>
mov    $0x9,%cl
jmp    1162 <Str_deformate+0x52>
nopl   (%rax)
mov    $0x20,%cl
jmp    1162 <Str_deformate+0x52>
mov    $0xa,%cl
jmp    11ca <Str_deformate+0xba>
mov    $0x20,%cl
mov    %cl,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @Str_deformate(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)
store i32 %6, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %51, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %54
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 36
br i1 %18, label %19, label %24
19: ; preds = %11
%20 = load i8*, i8** %2
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 32, i8* %23
br label %24
24: ; preds = %19, %11
%25 = load i8*, i8** %2
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 35
br i1 %31, label %32, label %37
32: ; preds = %24
%33 = load i8*, i8** %2
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 10, i8* %36
br label %37
37: ; preds = %32, %24
%38 = load i8*, i8** %2
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 38
br i1 %44, label %45, label %50
45: ; preds = %37
%46 = load i8*, i8** %2
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 9, i8* %49
br label %50
50: ; preds = %45, %37
br label %51
51: ; preds = %50
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %7
54: ; preds = %7
%55 = load i8*, i8** %2
ret i8* %55
}

LLVM IR (-O2):
define i8* @Str_deformate(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %20
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = and i64 %5, 1
%7 = icmp eq i32 %2, 1
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = and i64 %5, 4294967294
br label %21
10: ; preds = %38, %4
%11 = phi i64 [ 0, %4 ], [ %39, %38 ]
%12 = icmp eq i64 %6, 0
br i1 %12, label %20, label %13
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %0, i64 %11
%15 = load i8, i8* %14
switch i8 %15, label %20 [
i8 36, label %18
i8 35, label %17
i8 38, label %16
]
16: ; preds = %13
br label %18
17: ; preds = %13
br label %18
18: ; preds = %17, %16, %13
%19 = phi i8 [ 10, %17 ], [ 9, %16 ], [ 32, %13 ]
store i8 %19, i8* %14
br label %20
20: ; preds = %10, %18, %13, %1
ret i8* %0
21: ; preds = %38, %8
%22 = phi i64 [ 0, %8 ], [ %39, %38 ]
%23 = phi i64 [ 0, %8 ], [ %40, %38 ]
%24 = getelementptr inbounds i8, i8* %0, i64 %22
%25 = load i8, i8* %24
switch i8 %25, label %30 [
i8 36, label %28
i8 35, label %26
i8 38, label %27
]
26: ; preds = %21
br label %28
27: ; preds = %21
br label %28
28: ; preds = %21, %27, %26
%29 = phi i8 [ 10, %26 ], [ 9, %27 ], [ 32, %21 ]
store i8 %29, i8* %24
br label %30
30: ; preds = %28, %21
%31 = or i64 %22, 1
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
switch i8 %33, label %38 [
i8 36, label %36
i8 35, label %35
i8 38, label %34
]
34: ; preds = %30
br label %36
35: ; preds = %30
br label %36
36: ; preds = %35, %34, %30
%37 = phi i8 [ 10, %35 ], [ 9, %34 ], [ 32, %30 ]
store i8 %37, i8* %32
br label %38
38: ; preds = %36, %30
%39 = add nuw nsw i64 %22, 2
%40 = add i64 %23, 2
%41 = icmp eq i64 %40, %9
br i1 %41, label %10, label %21
}