#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 const *, int);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char const *);
void print_line(const char *sep, int len) {
  int w = strlen(sep);
  char str[w * len + 1];
  int i;
  for (i = 0; i < len; i++) {
    memcpy(str + i * w, sep, w);
  }
  str[w * len] = '\0';
  printf("%s", str);
}


x86 assembly (clang, -O0):
<print_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   %ecx,%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b7 <print_line+0x87>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1181 <print_line+0x51>
mov    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
movb   $0x0,(%rsi,%rax,1)
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_line>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r13d
imul   %ebx,%eax
mov    %rax,-0x38(%rbp)
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
test   %ebx,%ebx
jle    1197 <print_line+0x67>
movslq %r13d,%r12
mov    %ebx,%r15d
mov    -0x30(%rbp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1050 <memcpy@plt>
add    %r12,%rbx
add    $0xffffffffffffffff,%r15
jne    1180 <print_line+0x50>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp),%rsi
movb   $0x0,(%rsi,%rax,1)
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @print_line(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %6
%17 = alloca i8, i64 %15
store i64 %15, i64* %7
store i32 0, i32* %8
br label %18
18: ; preds = %31, %2
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i32, i32* %8
%24 = load i32, i32* %5
%25 = mul nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %17, i64 %26
%28 = load i8*, i8** %3
%29 = load i32, i32* %5
%30 = call i32 @memcpy(i8* %27, i8* %28, i32 %29)
br label %31
31: ; preds = %22
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %18
34: ; preds = %18
%35 = load i32, i32* %5
%36 = load i32, i32* %4
%37 = mul nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %17, i64 %38
store i8 0, i8* %39
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
%41 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @print_line(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = mul nsw i32 %3, %1
%5 = add nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = sext i32 %3 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %17, %12 ]
%14 = mul nsw i64 %13, %10
%15 = getelementptr inbounds i8, i8* %7, i64 %14
%16 = call i32 @memcpy(i8* %15, i8* %0, i32 %3)
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, %11
br i1 %18, label %19, label %12
19: ; preds = %12, %2
%20 = sext i32 %4 to i64
%21 = getelementptr inbounds i8, i8* %7, i64 %20
store i8 0, i8* %21
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}