#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*/ printf(char *, ...);
int main() {
  int f[100];
  f[1] = 0;
  for (int i = 2; i < 100; i++) {
    f[i] = (f[i - 1] + 3) % i;
  }
  for (int i = 1; i < 100; i++) {
    if (i % 6 == 1)
      printf("\n");
    printf("f[%3d]=%3d  ", i, f[i] + 1);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x19c(%rbp)
movl   $0x2,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    1181 <main+0x71>
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%eax
add    $0x3,%eax
cltd
idivl  -0x1a4(%rbp)
movslq -0x1a4(%rbp),%rax
mov    %edx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1136 <main+0x26>
movl   $0x1,-0x1a8(%rbp)
cmpl   $0x64,-0x1a8(%rbp)
jge    11f6 <main+0xe6>
mov    -0x1a8(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11bd <main+0xad>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%esi
movslq -0x1a8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edx
add    $0x1,%edx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    118b <main+0x7b>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x190,%rsp
movl   $0x0,0x4(%rsp)
mov    $0x2,%ecx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
add    $0x3,%edx
mov    %edx,%eax
cltd
idiv   %ecx
mov    %edx,(%rsp,%rcx,4)
lea    0x3(%rdx),%eax
lea    0x1(%rcx),%esi
cltd
idiv   %esi
mov    %edx,0x4(%rsp,%rcx,4)
add    $0x2,%rcx
cmp    $0x64,%rcx
jne    1140 <main+0x20>
mov    $0x1,%ebx
lea    0xe92(%rip),%r14
xor    %ebp,%ebp
jmp    11a0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp,%rbx,4),%edx
add    $0x1,%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0xff,%bpl
cmp    $0x64,%rbx
je     11c3 <main+0xa3>
movzbl %bl,%eax
imul   $0xab,%eax,%eax
shr    $0x9,%eax
and    $0xfffffffe,%eax
lea    (%rax,%rax,2),%eax
add    %bpl,%al
jne    1180 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [13 x i8] c"f[%3d]=%3d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 1
store i32 0, i32* %5
store i32 2, i32* %3
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 3
%16 = load i32, i32* %3
%17 = srem i32 %15, %16
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %19
store i32 %17, i32* %20
br label %21
21: ; preds = %9
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %6
24: ; preds = %6
store i32 1, i32* %4
br label %25
25: ; preds = %42, %24
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 100
br i1 %27, label %28, label %45
28: ; preds = %25
%29 = load i32, i32* %4
%30 = srem i32 %29, 6
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
%35 = load i32, i32* %4
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = add nsw i32 %39, 1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %40)
br label %42
42: ; preds = %34
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %25
45: ; preds = %25
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"f[%3d]=%3d \00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
store i32 0, i32* %3
br label %4
4: ; preds = %4, %0
%5 = phi i32 [ 0, %0 ], [ %14, %4 ]
%6 = phi i64 [ 2, %0 ], [ %16, %4 ]
%7 = add nsw i32 %5, 3
%8 = trunc i64 %6 to i32
%9 = srem i32 %7, %8
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %6
store i32 %9, i32* %10
%11 = or i64 %6, 1
%12 = add nsw i32 %9, 3
%13 = trunc i64 %11 to i32
%14 = srem i32 %12, %13
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %11
store i32 %14, i32* %15
%16 = add nuw nsw i64 %6, 2
%17 = icmp eq i64 %16, 100
br i1 %17, label %20, label %4
18: ; preds = %28
%19 = tail call i32 @putchar(i32 10)
ret i32 0
20: ; preds = %4, %28
%21 = phi i64 [ %33, %28 ], [ 1, %4 ]
%22 = trunc i64 %21 to i32
%23 = trunc i64 %21 to i8
%24 = urem i8 %23, 6
%25 = icmp eq i8 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %26, %20
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %21
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %31)
%33 = add nuw nsw i64 %21, 1
%34 = icmp eq i64 %33, 100
br i1 %34, label %18, label %20
}