#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*/ EXIT_FAILURE;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Error. Pls supply argument (integer).\n");
    exit(EXIT_FAILURE);
  }
  int n = atoi(argv[1]);
  if (n % 8) {
    printf("Error. N should be a multiple of 8, that's the nature of the "
           "exercise.\n");
    exit(EXIT_FAILURE);
  }
  int *nbf = malloc((n / 4) * sizeof(int));
  int i, ii, k;
  int firstbyte;
  if (0)
    firstbyte = 2;
  else
    firstbyte = 6;
  ii = 0;
  for (i = firstbyte; i < n; i += 2) {
    k = (i - firstbyte) % 8;
    if (!k) {
      nbf[ii] = i;
      nbf[ii + 1] = i + 1;
      ii += 2;
    }
  }
  for (i = 0; i < n / 4; ++i)
    printf("%d=%d ", i, nbf[i]);
  printf("\n");
  free(nbf);
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     118c <main+0x3c>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11cc <main+0x7c>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x6,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1263 <main+0x113>
mov    -0x24(%rbp),%eax
sub    -0x30(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1250 <main+0x100>
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%edx
add    $0x1,%edx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    1255 <main+0x105>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    11fc <main+0xac>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    12b2 <main+0x162>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    126a <main+0x11a>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1239 <main+0xc9>
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
test   $0x7,%r14b
jne    1242 <main+0xd2>
lea    0x3(%r14),%ebx
test   %r14d,%r14d
cmovns %r14d,%ebx
mov    %ebx,%edi
and    $0xfffffffc,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
cmp    $0x7,%r14d
jl     11e2 <main+0x72>
xor    %eax,%eax
mov    $0x6,%ecx
jmp    11c7 <main+0x57>
xchg   %ax,%ax
mov    %edx,%ecx
cmp    %r14d,%edx
jge    11e2 <main+0x72>
lea    0x2(%rcx),%edx
test   $0x6,%dl
jne    11c0 <main+0x50>
cltq
mov    %ecx,(%r15,%rax,4)
add    $0x1,%ecx
mov    %ecx,0x4(%r15,%rax,4)
add    $0x2,%eax
jmp    11c0 <main+0x50>
cmp    $0x4,%r14d
jl     1219 <main+0xa9>
sar    $0x2,%ebx
mov    %ebx,%r12d
lea    0xe0b(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1200 <main+0x90>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe0e(%rip),%rdi
jmp    1249 <main+0xd9>
lea    0xdbe(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Error. Pls supply argument (integer).\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [72 x i8] c"Error. N should be a multiple of 8, that's the nature of the exercise.\0A\00"
@.str.2 = [7 x i8] c"%d=%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = srem i32 %23, 8
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %18
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %18
%31 = load i32, i32* %6
%32 = sdiv i32 %31, 4
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 4
%35 = trunc i64 %34 to i32
%36 = call i32* @malloc(i32 %35)
store i32* %36, i32** %7
store i32 6, i32* %11
store i32 0, i32* %9
%37 = load i32, i32* %11
store i32 %37, i32* %8
br label %38
38: ; preds = %65, %30
%39 = load i32, i32* %8
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %68
42: ; preds = %38
%43 = load i32, i32* %8
%44 = load i32, i32* %11
%45 = sub nsw i32 %43, %44
%46 = srem i32 %45, 8
store i32 %46, i32* %10
%47 = load i32, i32* %10
%48 = icmp ne i32 %47, 0
br i1 %48, label %64, label %49
49: ; preds = %42
%50 = load i32, i32* %8
%51 = load i32*, i32** %7
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
store i32 %50, i32* %54
%55 = load i32, i32* %8
%56 = add nsw i32 %55, 1
%57 = load i32*, i32** %7
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %57, i64 %60
store i32 %56, i32* %61
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 2
store i32 %63, i32* %9
br label %64
64: ; preds = %49, %42
br label %65
65: ; preds = %64
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 2
store i32 %67, i32* %8
br label %38
68: ; preds = %38
store i32 0, i32* %8
br label %69
69: ; preds = %82, %68
%70 = load i32, i32* %8
%71 = load i32, i32* %6
%72 = sdiv i32 %71, 4
%73 = icmp slt i32 %70, %72
br i1 %73, label %74, label %85
74: ; preds = %69
%75 = load i32, i32* %8
%76 = load i32*, i32** %7
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %75, i32 %80)
br label %82
82: ; preds = %74
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 1
store i32 %84, i32* %8
br label %69
85: ; preds = %69
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%87 = load i32*, i32** %7
%88 = call i32 @free(i32* %87)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"%d=%d \00"
@str = [71 x i8] c"Error. N should be a multiple of 8, that's the nature of the exercise.\00"
@str.4 = [38 x i8] c"Error. Pls supply argument (integer).\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = and i32 %11, 7
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %8
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %8
%19 = sdiv i32 %11, 4
%20 = shl nsw i32 %19, 2
%21 = tail call i32* @malloc(i32 %20)
%22 = icmp sgt i32 %11, 6
br i1 %22, label %27, label %23
23: ; preds = %41, %18
%24 = icmp sgt i32 %11, 3
br i1 %24, label %25, label %52
25: ; preds = %23
%26 = zext i32 %19 to i64
br label %44
27: ; preds = %18, %41
%28 = phi i32 [ %30, %41 ], [ 6, %18 ]
%29 = phi i32 [ %42, %41 ], [ 0, %18 ]
%30 = add nuw nsw i32 %28, 2
%31 = and i32 %30, 6
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %27
%34 = sext i32 %29 to i64
%35 = getelementptr inbounds i32, i32* %21, i64 %34
store i32 %28, i32* %35
%36 = or i32 %28, 1
%37 = add nsw i32 %29, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %21, i64 %38
store i32 %36, i32* %39
%40 = add nsw i32 %29, 2
br label %41
41: ; preds = %27, %33
%42 = phi i32 [ %29, %27 ], [ %40, %33 ]
%43 = icmp slt i32 %30, %11
br i1 %43, label %27, label %23
44: ; preds = %25, %44
%45 = phi i64 [ 0, %25 ], [ %50, %44 ]
%46 = getelementptr inbounds i32, i32* %21, i64 %45
%47 = load i32, i32* %46
%48 = trunc i64 %45 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %48, i32 %47)
%50 = add nuw nsw i64 %45, 1
%51 = icmp eq i64 %50, %26
br i1 %51, label %52, label %44
52: ; preds = %44, %23
%53 = tail call i32 @putchar(i32 10)
%54 = tail call i32 @free(i32* %21)
ret i32 0
}