#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int print_values_matching(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int res;
  unsigned pow;
  if (argc < 2) {
    fprintf(stderr, "need a power of two");
    return 2;
  }
  pow = atoi(argv[1]);
  if (!pow || (pow & (pow - 1))) {
    fprintf(stderr, "need a power of two");
    return 3;
  }
  printf("{\n");
  res = print_values_matching(pow);
  printf("    \"irrelevant\": null\n}\n");
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1181 <main+0x41>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    11f9 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11af <main+0x6f>
mov    -0x18(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11d0 <main+0x90>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    11f9 <main+0xb9>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
call   1060 <print_values_matching@plt>
mov    %eax,-0x14(%rbp)
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     1162 <main+0x22>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x2,%eax
pop    %rbx
ret
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%eax
test   %eax,%ebx
sete   %al
test   %ebx,%ebx
setne  %cl
test   %al,%cl
je     11a3 <main+0x63>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1060 <print_values_matching@plt>
mov    %eax,%ebx
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x3,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"need a power of two\00"
@.str.1 = [3 x i8] c"{\0A\00"
@.str.2 = [26 x i8] c" \22irrelevant\22: null\0A}\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %35
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = load i32, i32* %7
%22 = load i32, i32* %7
%23 = sub i32 %22, 1
%24 = and i32 %21, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %20, %13
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 3, i32* %3
br label %35
29: ; preds = %20
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32, i32* %7
%32 = call i32 @print_values_matching(i32 %31)
store i32 %32, i32* %6
%33 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %6
store i32 %34, i32* %3
br label %35
35: ; preds = %29, %26, %10
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"need a power of two\00"
@str = [2 x i8] c"{\00"
@str.3 = [25 x i8] c" \22irrelevant\22: null\0A}\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %20
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @llvm.ctpop.i32(i32 %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %20
16: ; preds = %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @print_values_matching(i32 %10)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
br label %20
20: ; preds = %16, %13, %4
%21 = phi i32 [ 2, %4 ], [ 3, %13 ], [ %18, %16 ]
ret i32 %21
}