#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, char, int);
size_t strlen(char *);
void prais_manipulator_rt(char *msg) {
  size_t len;
  int times;
  int segment_size;
  int i;
  len = strlen(msg);
  segment_size = len + 8;
  times = (65 - 1) / segment_size;
  if (times < 2)
    return;
  memset(msg + len, ' ', (65 - 1) - len);
  for (i = 1; i < times; ++i) {
    memcpy(msg + i * segment_size, msg, segment_size);
  }
}


x86 assembly (clang, -O0):
<prais_manipulator_rt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %eax,-0x18(%rbp)
mov    $0x40,%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    116f <prais_manipulator_rt+0x3f>
jmp    11c9 <prais_manipulator_rt+0x99>
mov    -0x8(%rbp),%rdi
add    -0x10(%rbp),%rdi
mov    $0x40,%eax
sub    -0x10(%rbp),%rax
mov    %eax,%edx
mov    $0x20,%esi
call   1040 <memset@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c9 <prais_manipulator_rt+0x99>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1193 <prais_manipulator_rt+0x63>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prais_manipulator_rt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0x8(%rax),%r15d
mov    $0x40,%ecx
mov    $0x40,%eax
xor    %edx,%edx
idiv   %r15d
cmp    $0x2,%eax
jl     1197 <prais_manipulator_rt+0x67>
mov    %eax,%ebx
mov    %rsi,%rdi
add    %r14,%rdi
sub    %esi,%ecx
mov    $0x20,%esi
mov    %ecx,%edx
call   1040 <memset@plt>
movslq %r15d,%r12
mov    %ebx,%ebp
lea    (%r14,%r12,1),%rbx
add    $0xffffffffffffffff,%rbp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
add    %r12,%rbx
add    $0xffffffffffffffff,%rbp
jne    1180 <prais_manipulator_rt+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @prais_manipulator_rt(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = add i64 %9, 8
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = sdiv i32 64, %12
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %17
16: ; preds = %1
br label %42
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = load i64, i64* %3
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i64, i64* %3
%22 = sub i64 64, %21
%23 = trunc i64 %22 to i32
%24 = call i32 @memset(i8* %20, i8 signext 32, i32 %23)
store i32 1, i32* %6
br label %25
25: ; preds = %39, %17
%26 = load i32, i32* %6
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %42
29: ; preds = %25
%30 = load i8*, i8** %2
%31 = load i32, i32* %6
%32 = load i32, i32* %5
%33 = mul nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %30, i64 %34
%36 = load i8*, i8** %2
%37 = load i32, i32* %5
%38 = call i32 @memcpy(i8* %35, i8* %36, i32 %37)
br label %39
39: ; preds = %29
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %25
42: ; preds = %16, %25
ret void
}

LLVM IR (-O2):
define void @prais_manipulator_rt(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 8
%5 = sdiv i32 64, %4
%6 = icmp slt i32 %5, 2
br i1 %6, label %20, label %7
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %0, i64 %2
%9 = sub i32 64, %3
%10 = tail call i32 @memset(i8* %8, i8 signext 32, i32 %9)
%11 = sext i32 %4 to i64
%12 = zext i32 %5 to i64
br label %13
13: ; preds = %7, %13
%14 = phi i64 [ 1, %7 ], [ %18, %13 ]
%15 = mul nsw i64 %14, %11
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = tail call i32 @memcpy(i8* %16, i8* %0, i32 %4)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, %12
br i1 %19, label %20, label %13
20: ; preds = %13, %1
ret void
}