#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int s;
  scanf("%d", &s);
  int top = (s >> 1) + ((s & 1) ? 2 : 1);
  printf("%d:\n", s);
  for (int i = 2; i < top; i++) {
    int rem = s % ((i << 1) - 1);
    if (rem == 0 || rem == i)
      printf("%d,%d\n", i, i - 1);
    if (s % i == 0)
      printf("%d,%d\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    -0x8(%rbp),%esi
and    $0x1,%esi
mov    $0x1,%ecx
mov    $0x2,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fa <main+0xda>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ac <main+0x8c>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11c3 <main+0xa3>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11e7 <main+0xc7>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <main+0xcc>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <main+0x58>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%r15d
sar    %r15d
mov    %esi,%eax
and    $0x1,%eax
cmp    $0x1,%eax
sbb    $0x0,%r15d
add    $0x2,%r15d
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x3,%r15d
jl     11c8 <main+0xa8>
mov    $0x2,%ebx
mov    $0x3,%ebp
lea    0xe91(%rip),%r14
jmp    118b <main+0x6b>
nopl   0x0(%rax)
add    $0x1,%ebx
add    $0x2,%ebp
cmp    %ebx,%r15d
je     11c8 <main+0xa8>
mov    0x4(%rsp),%ecx
mov    %ecx,%eax
cltd
idiv   %ebp
test   %edx,%edx
je     119c <main+0x7c>
cmp    %edx,%ebx
jne    11af <main+0x8f>
lea    -0x1(%rbx),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1180 <main+0x60>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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