#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 *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strlen(char *);
int main(void) {
  void compress(char *in, char *out);
  char originalString[80] = {}, compressedString[80] = {};
  printf("Please enter your string for compression: ");
  scanf("%s79", originalString);
  compress(originalString, compressedString);
  printf("Compressed string: %s\n",
         strlen(compressedString) < strlen(originalString) ? compressedString
                                                           : originalString);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1060 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1060 <memset@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1030 <compress@plt>
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0xb8(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0xb8(%rbp),%rax
cmp    %rcx,%rax
jge    11f5 <main+0xa5>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
jmp    1200 <main+0xb0>
lea    -0x60(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <compress@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%r15
cmovl  %r14,%rbx
lea    0xe59(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Please enter your string for compression: \00"
@.str.1 = [5 x i8] c"%s79\00"
@.str.2 = [23 x i8] c"Compressed string: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
store i32 0, i32* %1
%4 = bitcast [80 x i8]* %2 to i8*
%5 = bitcast [80 x i8]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%12 = call i64 @strlen(i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i64 @strlen(i8* %13)
%15 = icmp slt i64 %12, %14
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
br label %20
18: ; preds = %0
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
br label %20
20: ; preds = %18, %16
%21 = phi i8* [ %17, %16 ], [ %19, %18 ]
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Please enter your string for compression: \00"
@.str.1 = [5 x i8] c"%s79\00"
@.str.2 = [23 x i8] c"Compressed string: %s\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i64 @strlen(i8* %4)
%8 = call i64 @strlen(i8* %3)
%9 = icmp slt i64 %7, %8
%10 = select i1 %9, i8* %4, i8* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %10)
ret i32 0
}