#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 EXIT_FAILURE;
int EXIT_SUCCESS;
unsigned int MSP(size_t, char const *, unsigned int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ minrep(char *, char const *, size_t);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
size_t strlen(char const *);
int main(int argc, const char **argv) {
  if (argc != 2) {
    fprintf(stderr,
            "An argument must be provided: string of letters or digits\n");
    return EXIT_FAILURE;
  }
  unsigned int d;
  size_t n = strlen(argv[1]);
  char *str = malloc(sizeof(char) * (n + 1));
  minrep(str, argv[1], n);
  str[n] = '\0';
  unsigned int msp = MSP(n, argv[1], &d);
  fprintf(stdout, "%d\t%d\t%s\n", msp + 1, d, str);
  free(str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1242 <main+0xe2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <minrep@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <MSP@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%r8
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11e0 <main+0x80>
mov    %rsi,%r14
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
lea    0x1(%rax),%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <minrep@plt>
movb   $0x0,(%r12,%rbx,1)
mov    0x8(%r14),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <MSP@plt>
mov    0x2e1b(%rip),%rcx
mov    (%rcx),%edi
lea    0x1(%rax),%edx
mov    0x4(%rsp),%ecx
lea    0xe76(%rip),%rsi
mov    %r12,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x2dea(%rip),%rax
jmp    11fe <main+0x9e>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"An argument must be provided: string of letters or digits\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [10 x i8] c"%d\09%d\09%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %3
br label %49
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strlen(i8* %19)
store i64 %20, i64* %7
%21 = load i64, i64* %7
%22 = add i64 %21, 1
%23 = mul i64 1, %22
%24 = trunc i64 %23 to i32
%25 = call i8* @malloc(i32 %24)
store i8* %25, i8** %8
%26 = load i8*, i8** %8
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i64, i64* %7
%31 = call i32 @minrep(i8* %26, i8* %29, i64 %30)
%32 = load i8*, i8** %8
%33 = load i64, i64* %7
%34 = getelementptr inbounds i8, i8* %32, i64 %33
store i8 0, i8* %34
%35 = load i64, i64* %7
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @MSP(i64 %35, i8* %38, i32* %6)
store i32 %39, i32* %9
%40 = load i32, i32* @stdout
%41 = load i32, i32* %9
%42 = add i32 %41, 1
%43 = load i32, i32* %6
%44 = load i8*, i8** %8
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43, i8* %44)
%46 = load i8*, i8** %8
%47 = call i32 @free(i8* %46)
%48 = load i32, i32* @EXIT_SUCCESS
store i32 %48, i32* %3
br label %49
49: ; preds = %16, %12
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"An argument must be provided: string of letters or digits\0A\00"
@EXIT_FAILURE = global i32 0
@stdout = global i32 0
@.str.1 = [10 x i8] c"%d\09%d\09%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
br label %27
9: ; preds = %2
%10 = bitcast i32* %3 to i8*
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strlen(i8* dereferenceable(1) %12)
%14 = trunc i64 %13 to i32
%15 = add i32 %14, 1
%16 = tail call i8* @malloc(i32 %15)
%17 = tail call i32 @minrep(i8* %16, i8* %12, i64 %13)
%18 = getelementptr inbounds i8, i8* %16, i64 %13
store i8 0, i8* %18
%19 = load i8*, i8** %11
%20 = call i32 @MSP(i64 %13, i8* %19, i32* %3)
%21 = load i32, i32* @stdout
%22 = add i32 %20, 1
%23 = load i32, i32* %3
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23, i8* %16)
%25 = call i32 @free(i8* %16)
%26 = load i32, i32* @EXIT_SUCCESS
br label %27
27: ; preds = %9, %5
%28 = phi i32 [ %8, %5 ], [ %26, %9 ]
ret i32 %28
}