#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ seq;

/* Variables and functions */
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdout;
int main(int argc, char *args[]) {
  uint8_t seq[] = {0x6f, 0x34, 0xcb, 0xc8, 0x37, 0x90};
  int seq_len = sizeof(seq);
  int N = 500000;
  if (argc > 1)
    sscanf(args[1], "%d", &N);
  for (int n = 0; n < N; n++) {
    fwrite(&seq[n % seq_len], 1, 1, stdout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x18,-0x34(%rbp)
movl   $0x7a120,-0x38(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1187 <main+0x67>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9a(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <sscanf@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11d2 <main+0xb2>
mov    -0x3c(%rbp),%eax
cltd
idivl  -0x34(%rbp)
movslq %edx,%rax
lea    -0x30(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    0x2e2a(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fwrite@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118e <main+0x6e>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0xede(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x7a120,0xc(%rsp)
cmp    $0x2,%edi
jl     116c <main+0x4c>
mov    0x8(%rsi),%rdi
lea    0xebd(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1030 <sscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11c8 <main+0xa8>
lea    0x10(%rsp),%r14
xor    %ebx,%ebx
movabs $0xaaaaaaaaaaaaaaab,%r15
aa aa aa
mov    0x2e5c(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rax
mul    %r15
add    %rdx,%rdx
and    $0xffffffffffffffe0,%rdx
lea    (%rdx,%rdx,2),%rax
mov    %r14,%rdi
sub    %rax,%rdi
mov    (%r12),%ecx
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
add    $0x1,%rbx
add    $0x4,%r14
cmp    0xc(%rsp),%ebx
jl     1190 <main+0x70>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.seq = [6 x i32] [i32 111, i32 52, i32 203, i32 200, i32 55, i32 144]
@.str = [3 x i8] c"%d\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [6 x i32]* %6 to i8*
store i32 24, i32* %7
store i32 500000, i32* %8
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
br label %18
18: ; preds = %13, %2
store i32 0, i32* %9
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %8
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = load i32, i32* %9
%25 = load i32, i32* %7
%26 = srem i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 %27
%29 = load i32, i32* @stdout
%30 = call i32 @fwrite(i32* %28, i32 1, i32 1, i32 %29)
br label %31
31: ; preds = %23
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %19
34: ; preds = %19
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@__const.main.seq = [6 x i32] [i32 111, i32 52, i32 203, i32 200, i32 55, i32 144]
@.str = [3 x i8] c"%d\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = bitcast [6 x i32]* %3 to i8*
%6 = bitcast i32* %4 to i8*
store i32 500000, i32* %4
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2, %8
br label %16
15: ; preds = %16, %8
ret i32 0
16: ; preds = %14, %16
%17 = phi i32 [ %23, %16 ], [ 0, %14 ]
%18 = urem i32 %17, 24
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %19
%21 = load i32, i32* @stdout
%22 = call i32 @fwrite(i32* %20, i32 1, i32 1, i32 %21)
%23 = add nuw nsw i32 %17, 1
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %16, label %15
}