#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, unsigned int *, unsigned int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ xz(unsigned int, unsigned int);
int main(int argc, char *argv[]) {
  FILE *fp;
  unsigned nz, x, i;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d %d", &nz, &x) != EOF) {
    unsigned r = 0;
    for (i = 1 << nz; i <= x; i++)
      if (xz(nz, i))
        r++;
    printf("%d\n", r);
  }
  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     1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123a <main+0xfa>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe77(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <fscanf@plt>
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%rax
je     1233 <main+0xf3>
movl   $0x0,-0x28(%rbp)
mov    -0x1c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
ja     121d <main+0xdd>
mov    -0x1c(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1050 <xz@plt>
cmp    $0x0,%rax
je     120a <main+0xca>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    120f <main+0xcf>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11e0 <main+0xa0>
mov    -0x28(%rbp),%esi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a4 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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    1233 <main+0xf3>
mov    0x8(%rsi),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea6(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    0x2e63(%rip),%rcx
xor    %ebp,%ebp
cmp    (%rcx),%rax
je     1249 <main+0x109>
lea    0x4(%rsp),%r12
mov    %rsp,%r13
xor    %ebp,%ebp
jmp    11d2 <main+0x92>
nopl   0x0(%rax)
lea    0xe73(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0xe59(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <fscanf@plt>
mov    0x2e1b(%rip),%rcx
cmp    (%rcx),%rax
je     1249 <main+0x109>
mov    0x4(%rsp),%ecx
mov    $0x1,%r14d
shl    %cl,%r14d
mov    $0x0,%r15d
cmp    (%rsp),%r14d
ja     11a0 <main+0x60>
mov    %ecx,%edi
mov    %r14d,%esi
call   1050 <xz@plt>
xor    %r15d,%r15d
test   %rax,%rax
setne  %r15b
cmp    (%rsp),%r14d
jae    11a0 <main+0x60>
add    $0x1,%r14d
nopl   0x0(%rax)
mov    0x4(%rsp),%edi
mov    %r14d,%esi
call   1050 <xz@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
add    $0x1,%r14d
cmp    (%rsp),%r14d
jbe    1210 <main+0xd0>
jmp    11a0 <main+0x60>
mov    (%rsi),%rsi
lea    0xdc3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %51
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
br label %23
23: ; preds = %47, %18
%24 = load i32*, i32** %6
%25 = call i64 @fscanf(i32* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %7, i32* %8)
%26 = load i64, i64* @EOF
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %50
28: ; preds = %23
store i32 0, i32* %10
%29 = load i32, i32* %7
%30 = shl i32 1, %29
store i32 %30, i32* %9
br label %31
31: ; preds = %44, %28
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = icmp ule i32 %32, %33
br i1 %34, label %35, label %47
35: ; preds = %31
%36 = load i32, i32* %7
%37 = load i32, i32* %9
%38 = call i64 @xz(i32 %36, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i32, i32* %10
%42 = add i32 %41, 1
store i32 %42, i32* %10
br label %43
43: ; preds = %40, %35
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add i32 %45, 1
store i32 %46, i32* %9
br label %31
47: ; preds = %31
%48 = load i32, i32* %10
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %48)
br label %23
50: ; preds = %23
store i32 0, i32* %3
br label %51
51: ; preds = %50, %13
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %48
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %48, label %18
18: ; preds = %11, %42
%19 = load i32, i32* %3
%20 = shl nuw i32 1, %19
%21 = load i32, i32* %4
%22 = icmp ugt i32 %20, %21
br i1 %22, label %42, label %23
23: ; preds = %18
%24 = call i64 @xz(i32 %19, i32 %20)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
%27 = load i32, i32* %4
%28 = icmp ult i32 %20, %27
br i1 %28, label %29, label %42
29: ; preds = %23
%30 = add nuw i32 %20, 1
br label %31
31: ; preds = %29, %31
%32 = phi i32 [ %30, %29 ], [ %39, %31 ]
%33 = phi i32 [ %26, %29 ], [ %38, %31 ]
%34 = load i32, i32* %3
%35 = call i64 @xz(i32 %34, i32 %32)
%36 = icmp ne i64 %35, 0
%37 = zext i1 %36 to i32
%38 = add i32 %33, %37
%39 = add i32 %32, 1
%40 = load i32, i32* %4
%41 = icmp ugt i32 %39, %40
br i1 %41, label %42, label %31
42: ; preds = %31, %23, %18
%43 = phi i32 [ 0, %18 ], [ %26, %23 ], [ %38, %31 ]
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4)
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %45, %46
br i1 %47, label %48, label %18
48: ; preds = %42, %11, %8
%49 = phi i32 [ 1, %8 ], [ 0, %11 ], [ 0, %42 ]
ret i32 %49
}