#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*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
char *uncompress(char *);
int main(void) {
  char *orig = "AAAABBBBCCJJJJHHHSSZZZZZZZZNNNCCCCCCCC";
  char *compressed = "A*4B*4CCJ*4HHHSSZ*8NNNC*8";
  puts("Decodierter String:");
  char *decoded = uncompress(compressed);
  printf("%s\n", decoded);
  puts("Überprüfung:");
  printf("%s\n", orig);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed6(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1040 <uncompress@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xedc(%rip),%rdi
call   1050 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1040 <uncompress@plt>
lea    0xf05(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"AAAABBBBCCJJJJHHHSSZZZZZZZZNNNCCCCCCCC\00"
@.str.1 = [26 x i8] c"A*4B*4CCJ*4HHHSSZ*8NNNC*8\00"
@.str.2 = [20 x i8] c"Decodierter String:\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [15 x i8] c"\C3\9Cberpr\C3\BCfung:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %3
%5 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i8* @uncompress(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [39 x i8] c"AAAABBBBCCJJJJHHHSSZZZZZZZZNNNCCCCCCCC\00"
@.str.1 = [26 x i8] c"A*4B*4CCJ*4HHHSSZ*8NNNC*8\00"
@.str.2 = [20 x i8] c"Decodierter String:\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [15 x i8] c"\C3\9Cberpr\C3\BCfung:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i8* @uncompress(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i32 0
}