int main() {
  unsigned char *msg = "chaine", *m;
  *m = "chaine";
  printf("char %d\nshort %d\nint %d\nunsigned char %d\nunsigned short "
         "%d\nunsigned int %d",
         sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned char),
         sizeof(unsigned short), sizeof(unsigned int));
  printf("\nmsg:\n");
  while (*msg != 0) {
    printf("%c", *msg++);
  }
  printf("\nm:\n");
  while (*m != 0) {
    printf("%c", *m++);
  }
  printf("\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
lea    0xecb(%rip),%rcx
mov    %cl,(%rax)
lea    0xec9(%rip),%rdi
mov    $0x1,%r8d
mov    $0x2,%r9d
mov    $0x4,%ecx
mov    %r8,%rsi
mov    %r9,%rdx
movq   $0x4,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     11a7 <main+0x97>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1172 <main+0x62>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     11ea <main+0xda>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0xa5>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [7 x i8] c"chaine\00"
@.str.1 = [75 x i8] c"char %d\0Ashort %d\0Aint %d\0Aunsigned char %d\0Aunsigned short %d\0Aunsigned int %d\00"
@.str.2 = [7 x i8] c"\0Amsg:\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [5 x i8] c"\0Am:\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %3
store i8 ptrtoint ([7 x i8]* @.str to i8), i8* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i64 1, i64 2, i64 4, i64 1, i64 2, i64 4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %12, %0
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %13
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %16)
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %25, %18
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
%28 = load i8, i8* %26
%29 = zext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %20
31: ; preds = %20
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):