#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*/ putchar(char);
void print_sequence(char *sequence, int seq_length, int wrap_length) {
  int i = 0;
  for (i = 0; i < seq_length; i++) {
    if (i != 0 && i % wrap_length == 0) {
      putchar('\n');
    }
    putchar(sequence[i]);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117f <print_sequence+0x6f>
cmpl   $0x0,-0x14(%rbp)
je     1160 <print_sequence+0x50>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1160 <print_sequence+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <print_sequence+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sequence>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1130 <print_sequence+0x20>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
movsbl (%rdi),%edi
call   1030 <putchar@plt>
cmp    $0x1,%ebp
jne    1144 <print_sequence+0x34>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
mov    %ebp,%ebx
mov    $0x1,%ebp
jmp    1163 <print_sequence+0x53>
nopl   (%rax)
movsbl (%r15,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1130 <print_sequence+0x20>
mov    %ebp,%eax
cltd
idiv   %r14d
test   %edx,%edx
jne    1150 <print_sequence+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <print_sequence+0x40>

LLVM IR (-O0):
define void @print_sequence(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %7
br label %8
8: ; preds = %29, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = srem i32 %16, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @putchar(i8 signext 10)
br label %22
22: ; preds = %20, %15, %12
%23 = load i8*, i8** %4
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @putchar(i8 signext %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %8
32: ; preds = %8
%33 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @print_sequence(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %23
5: ; preds = %3
%6 = zext i32 %1 to i64
%7 = load i8, i8* %0
%8 = tail call i32 @putchar(i8 signext %7)
%9 = icmp eq i32 %1, 1
br i1 %9, label %23, label %10
10: ; preds = %5, %17
%11 = phi i64 [ %21, %17 ], [ 1, %5 ]
%12 = trunc i64 %11 to i32
%13 = srem i32 %12, %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 @putchar(i8 signext 10)
br label %17
17: ; preds = %15, %10
%18 = getelementptr inbounds i8, i8* %0, i64 %11
%19 = load i8, i8* %18
%20 = tail call i32 @putchar(i8 signext %19)
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %6
br i1 %22, label %23, label %10
23: ; preds = %17, %5, %3
%24 = tail call i32 @putchar(i8 signext 10)
ret void
}