#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 */
scalar_t__ EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fputc(char, int /*<<< orphan*/);
scalar_t__ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
void print_sequence(char *header, char *s, int n) {
  int i = 60;
  printf("%s\n", header);
  while (i < n) {
    if (fwrite(s, sizeof(char), 60, stdout) == 0)
      exit(EXIT_FAILURE);
    if (fputc('\n', stdout) == EOF)
      exit(EXIT_FAILURE);
    i += 60;
    s += 60;
  }
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<print_sequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x3c,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f5 <print_sequence+0xb5>
mov    -0x10(%rbp),%rdi
mov    0x2e4f(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x3c,%edx
call   1060 <fwrite@plt>
cmp    $0x0,%rax
jne    11aa <print_sequence+0x6a>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
mov    0x2e24(%rip),%rcx
cmp    (%rcx),%rax
jne    11db <print_sequence+0x9b>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x3c,%rax
mov    %rax,-0x10(%rbp)
jmp    116a <print_sequence+0x2a>
mov    -0x10(%rbp),%rsi
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sequence>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x3d,%r14d
jl     11b9 <print_sequence+0x79>
mov    $0x3c,%ebp
mov    0x2e61(%rip),%r15
mov    0x2e72(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3c,%edx
call   1060 <fwrite@plt>
test   %rax,%rax
je     11d0 <print_sequence+0x90>
mov    (%r15),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
cmp    (%r12),%rax
je     11d0 <print_sequence+0x90>
add    $0x3c,%ebp
add    $0x3c,%rbx
cmp    %r14d,%ebp
jl     1180 <print_sequence+0x40>
lea    0xe40(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
@EOF = global i64 0
define void @print_sequence(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 60, i32* %7
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %30, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i32, i32* @stdout
%17 = call i64 @fwrite(i8* %15, i32 1, i32 60, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %14
%23 = load i32, i32* @stdout
%24 = call i64 @fputc(i8 signext 10, i32 %23)
%25 = load i64, i64* @EOF
%26 = icmp eq i64 %24, %25
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %22
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 60
store i32 %32, i32* %7
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 60
store i8* %34, i8** %5
br label %10
35: ; preds = %10
%36 = load i8*, i8** %5
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %36)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
@EOF = global i64 0
define void @print_sequence(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp sgt i32 %2, 60
br i1 %5, label %6, label %27
6: ; preds = %3, %23
%7 = phi i32 [ %24, %23 ], [ 60, %3 ]
%8 = phi i8* [ %25, %23 ], [ %1, %3 ]
%9 = load i32, i32* @stdout
%10 = tail call i64 @fwrite(i8* %8, i32 1, i32 60, i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %6
%16 = load i32, i32* @stdout
%17 = tail call i64 @fputc(i8 signext 10, i32 %16)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %15
%24 = add nuw nsw i32 %7, 60
%25 = getelementptr inbounds i8, i8* %8, i64 60
%26 = icmp slt i32 %24, %2
br i1 %26, label %6, label %27
27: ; preds = %23, %3
%28 = phi i8* [ %1, %3 ], [ %25, %23 ]
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %28)
ret void
}