#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*/ strcat(char *, char *);
char *strcpy(char *, char *);
char *STRRPT(char *Result, char *S, short N) {
  char St[256];
  short I;
  *St = '\0';
  for (I = 1; I <= N; I++)
    strcat(St, S);
  return strcpy(Result, St);
}


x86 assembly (clang, -O0):
<STRRPT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movb   $0x0,-0x120(%rbp)
movw   $0x1,-0x122(%rbp)
movswl -0x122(%rbp),%eax
movswl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jg     1184 <STRRPT+0x64>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x122(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x122(%rbp)
jmp    114a <STRRPT+0x2a>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STRRPT>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %edx,%ebp
mov    %rdi,%r14
movb   $0x0,(%rsp)
test   %bp,%bp
jle    1163 <STRRPT+0x43>
mov    %rsi,%r12
mov    $0x1,%bx
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strcat@plt>
add    $0x1,%ebx
cmp    %bp,%bx
jle    1150 <STRRPT+0x30>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @STRRPT(i8* %0, i8* %1, i16 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i16
%7 = alloca [256 x i8]
%8 = alloca i16
store i8* %0, i8** %4
store i8* %1, i8** %5
store i16 %2, i16* %6
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
store i8 0, i8* %9
store i16 1, i16* %8
br label %10
10: ; preds = %20, %3
%11 = load i16, i16* %8
%12 = sext i16 %11 to i32
%13 = load i16, i16* %6
%14 = sext i16 %13 to i32
%15 = icmp sle i32 %12, %14
br i1 %15, label %16, label %23
16: ; preds = %10
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%18 = load i8*, i8** %5
%19 = call i32 @strcat(i8* %17, i8* %18)
br label %20
20: ; preds = %16
%21 = load i16, i16* %8
%22 = add i16 %21, 1
store i16 %22, i16* %8
br label %10
23: ; preds = %10
%24 = load i8*, i8** %4
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%26 = call i8* @strcpy(i8* %24, i8* %25)
ret i8* %26
}

LLVM IR (-O2):
define i8* @STRRPT(i8* returned %0, i8* %1, i16 signext %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%6 = icmp slt i16 %2, 1
br i1 %6, label %12, label %7
7: ; preds = %3, %7
%8 = phi i16 [ %10, %7 ], [ 1, %3 ]
%9 = call i32 @strcat(i8* %5, i8* %1)
%10 = add i16 %8, 1
%11 = icmp sgt i16 %10, %2
br i1 %11, label %12, label %7
12: ; preds = %7, %3
%13 = call i8* @strcpy(i8* dereferenceable(1) %0, i8* %5)
ret i8* %0
}