#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i, numNodes, j;
  if (argc != 2) {
    printf("Usage: %s <num-nodes>\n", argv[0]);
    exit(1);
  }
  numNodes = atoi(argv[1]);
  for (i = 0, j = 2; i <= (numNodes + 1) / 2 - 2; i++) {
    printf("%d:%d %d:%d ", i, 2 * i + 1, i, 2 * i + 2);
    if ((i == j - 2) || (i == (numNodes + 1) / 2 - 2)) {
      j *= 2;
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     1239 <main+0x109>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
shl    $0x1,%edx
add    $0x1,%edx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
shl    $0x1,%r8d
add    $0x2,%r8d
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
je     120f <main+0xdf>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jne    1226 <main+0xf6>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0xfb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x5d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11fb <main+0xbb>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
cmp    $0x3,%eax
jge    1173 <main+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ecx
add    $0x1,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%r15d
add    $0x1,%r15d
sar    %r15d
add    $0xfffffffe,%r15d
test   %r15d,%r15d
mov    $0x0,%r12d
cmovg  %r15d,%r12d
add    $0x1,%r12d
mov    $0x2,%ebx
lea    0xe70(%rip),%r14
mov    $0x2,%r13d
xor    %ebp,%ebp
jmp    11d8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %r13d,%r13d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
add    $0x2,%ebx
cmp    %ebp,%r12d
je     1162 <main+0x22>
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%ecx
mov    %ebx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x2(%r13),%eax
cmp    %eax,%ebp
je     11c0 <main+0x80>
cmp    %ebp,%r15d
jne    11cd <main+0x8d>
jmp    11c0 <main+0x80>
mov    (%rsi),%rsi
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s <num-nodes>\0A\00"
@.str.1 = [13 x i8] c"%d:%d %d:%d \00"
@.str.2 = [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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %7
store i32 0, i32* %6
store i32 2, i32* %8
br label %22
22: ; preds = %55, %17
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
%26 = sdiv i32 %25, 2
%27 = sub nsw i32 %26, 2
%28 = icmp sle i32 %23, %27
br i1 %28, label %29, label %58
29: ; preds = %22
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = mul nsw i32 2, %31
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %6
%35 = load i32, i32* %6
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %36, 2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %33, i32 %34, i32 %37)
%39 = load i32, i32* %6
%40 = load i32, i32* %8
%41 = sub nsw i32 %40, 2
%42 = icmp eq i32 %39, %41
br i1 %42, label %50, label %43
43: ; preds = %29
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
%47 = sdiv i32 %46, 2
%48 = sub nsw i32 %47, 2
%49 = icmp eq i32 %44, %48
br i1 %49, label %50, label %54
50: ; preds = %43, %29
%51 = load i32, i32* %8
%52 = mul nsw i32 %51, 2
store i32 %52, i32* %8
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %50, %43
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %22
58: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s <num-nodes>\0A\00"
@.str.1 = [13 x i8] c"%d:%d %d:%d \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 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
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 = add nsw i32 %11, 1
%13 = sdiv i32 %12, 2
%14 = add nsw i32 %13, -2
%15 = icmp slt i32 %11, 3
br i1 %15, label %36, label %16
16: ; preds = %8
%17 = call i32 @llvm.smax.i32(i32 %14, i32 0)
br label %18
18: ; preds = %16, %32
%19 = phi i32 [ %33, %32 ], [ 2, %16 ]
%20 = phi i32 [ %34, %32 ], [ 0, %16 ]
%21 = shl nuw nsw i32 %20, 1
%22 = or i32 %21, 1
%23 = add nuw nsw i32 %21, 2
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22, i32 %20, i32 %23)
%25 = add nsw i32 %19, -2
%26 = icmp eq i32 %20, %25
%27 = icmp eq i32 %20, %14
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = shl nsw i32 %19, 1
%31 = tail call i32 @putchar(i32 10)
br label %32
32: ; preds = %18, %29
%33 = phi i32 [ %30, %29 ], [ %19, %18 ]
%34 = add nuw nsw i32 %20, 1
%35 = icmp eq i32 %20, %17
br i1 %35, label %36, label %18
36: ; preds = %32, %8
ret i32 0
}