#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 pow(int, int);
int get_dbm(int m) {
  int n = m - 1;
  int dbm = 0;
  int a[16];
  int i;
  int j;
  for (i = 0; i != 16; ++i) {
    a[16 - 1 - i] = n % 2;
    n /= 2;
  }
  for (i = 15; i != 0; i--) {
    a[i] = !a[i];
  }
  for (i = 15, j = 0; i != 0; i--, j++) {
    dbm += a[i] * pow(2, j);
  }
  return -dbm;
}


x86 assembly (clang, -O0):
<get_dbm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x10,-0x54(%rbp)
je     1171 <get_dbm+0x61>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0xf,%eax
sub    -0x54(%rbp),%eax
cltq
mov    %edx,-0x50(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1132 <get_dbm+0x22>
movl   $0xf,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     11ab <get_dbm+0x9b>
movslq -0x54(%rbp),%rax
cmpl   $0x0,-0x50(%rbp,%rax,4)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
jmp    1178 <get_dbm+0x68>
movl   $0xf,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     1200 <get_dbm+0xf0>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11b9 <get_dbm+0xa9>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dbm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
add    $0xffffffff,%edi
mov    $0x10,%eax
nopl   0x0(%rax)
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
mov    %ecx,%edx
and    $0xfffffffe,%edx
mov    %edi,%esi
sub    %edx,%esi
mov    %esi,0x3c(%rsp,%rax,4)
mov    %ecx,%edx
sar    %edx
shr    $0x1f,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%edx
mov    %edx,0x38(%rsp,%rax,4)
lea    0x3(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
sar    $0x2,%ecx
mov    %ecx,%edi
add    $0xfffffffffffffffe,%rax
jne    1130 <get_dbm+0x20>
mov    0x7c(%rsp),%r15d
mov    0x78(%rsp),%r14d
mov    0x74(%rsp),%ebp
mov    0x70(%rsp),%r13d
mov    0x6c(%rsp),%r12d
mov    0x68(%rsp),%eax
mov    %eax,(%rsp)
mov    0x64(%rsp),%eax
mov    %eax,0x4(%rsp)
movups 0x44(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
movdqu 0x54(%rsp),%xmm0
movdqa %xmm0,0x30(%rsp)
xor    %ebx,%ebx
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <pow@plt>
test   %r15d,%r15d
cmovne %ebx,%eax
mov    %eax,0x1c(%rsp)
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <pow@plt>
test   %r14d,%r14d
cmovne %ebx,%eax
mov    %eax,0x18(%rsp)
mov    $0x2,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
test   %ebp,%ebp
cmovne %ebx,%eax
mov    %eax,0x14(%rsp)
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
test   %r13d,%r13d
cmovne %ebx,%eax
mov    %eax,0x10(%rsp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <pow@plt>
test   %r12d,%r12d
cmovne %ebx,%eax
mov    %eax,0xc(%rsp)
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
cmpl   $0x0,(%rsp)
cmovne %ebx,%ebp
mov    $0x2,%edi
mov    $0x6,%esi
call   1030 <pow@plt>
mov    %eax,%r14d
cmpl   $0x0,0x4(%rsp)
pxor   %xmm0,%xmm0
movdqa 0x20(%rsp),%xmm1
pcmpeqd %xmm0,%xmm1
movdqa %xmm1,0x20(%rsp)
movdqa 0x30(%rsp),%xmm1
pcmpeqd %xmm0,%xmm1
movdqa %xmm1,0x30(%rsp)
cmovne %ebx,%r14d
mov    $0x2,%edi
mov    $0x7,%esi
call   1030 <pow@plt>
mov    %eax,0x4(%rsp)
mov    $0x2,%edi
mov    $0x8,%esi
call   1030 <pow@plt>
mov    %eax,(%rsp)
mov    $0x2,%edi
mov    $0x9,%esi
call   1030 <pow@plt>
mov    %eax,0x8(%rsp)
mov    $0x2,%edi
mov    $0xa,%esi
call   1030 <pow@plt>
mov    %eax,%r15d
mov    $0x2,%edi
mov    $0xb,%esi
call   1030 <pow@plt>
mov    %eax,%r13d
mov    $0x2,%edi
mov    $0xc,%esi
call   1030 <pow@plt>
mov    %eax,%r12d
mov    $0x2,%edi
mov    $0xd,%esi
call   1030 <pow@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0xe,%esi
call   1030 <pow@plt>
movd   %r13d,%xmm0
movd   %r12d,%xmm1
punpckldq %xmm0,%xmm1
movd   %ebx,%xmm0
movd   %eax,%xmm2
punpckldq %xmm0,%xmm2
punpcklqdq %xmm1,%xmm2
pand   0x20(%rsp),%xmm2
movd   0x4(%rsp),%xmm0
movd   (%rsp),%xmm1
punpckldq %xmm0,%xmm1
movd   0x8(%rsp),%xmm0
movd   %r15d,%xmm3
punpckldq %xmm0,%xmm3
punpcklqdq %xmm1,%xmm3
pand   0x30(%rsp),%xmm3
paddd  %xmm2,%xmm3
pshufd $0xee,%xmm3,%xmm0
paddd  %xmm3,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
add    %r14d,%eax
add    %ebp,%eax
add    0xc(%rsp),%eax
add    0x10(%rsp),%eax
add    0x14(%rsp),%eax
add    0x18(%rsp),%eax
add    0x1c(%rsp),%eax
neg    %eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_dbm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i32]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %3
store i32 0, i32* %4
store i32 0, i32* %6
br label %10
10: ; preds = %22, %1
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 16
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %3
%15 = srem i32 %14, 2
%16 = load i32, i32* %6
%17 = sub nsw i32 15, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %18
store i32 %15, i32* %19
%20 = load i32, i32* %3
%21 = sdiv i32 %20, 2
store i32 %21, i32* %3
br label %22
22: ; preds = %13
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %10
25: ; preds = %10
store i32 15, i32* %6
br label %26
26: ; preds = %40, %25
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %29
%41 = load i32, i32* %6
%42 = add nsw i32 %41, -1
store i32 %42, i32* %6
br label %26
43: ; preds = %26
store i32 15, i32* %6
store i32 0, i32* %7
br label %44
44: ; preds = %57, %43
%45 = load i32, i32* %6
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %62
47: ; preds = %44
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [16 x i32], [16 x i32]* %5, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = load i32, i32* %7
%53 = call i32 @pow(i32 2, i32 %52)
%54 = mul nsw i32 %51, %53
%55 = load i32, i32* %4
%56 = add nsw i32 %55, %54
store i32 %56, i32* %4
br label %57
57: ; preds = %47
%58 = load i32, i32* %6
%59 = add nsw i32 %58, -1
store i32 %59, i32* %6
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %44
62: ; preds = %44
%63 = load i32, i32* %4
%64 = sub nsw i32 0, %63
ret i32 %64
}

LLVM IR (-O2):
define i32 @get_dbm(i32 %0) {
%2 = alloca [16 x i32]
%3 = add nsw i32 %0, -1
%4 = bitcast [16 x i32]* %2 to i8*
br label %5
5: ; preds = %5, %1
%6 = phi i64 [ 0, %1 ], [ %16, %5 ]
%7 = phi i32 [ %3, %1 ], [ %15, %5 ]
%8 = srem i32 %7, 2
%9 = sub nuw nsw i64 15, %6
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 %9
store i32 %8, i32* %10
%11 = sdiv i32 %7, 2
%12 = srem i32 %11, 2
%13 = sub nsw i64 14, %6
%14 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 %13
store i32 %12, i32* %14
%15 = sdiv i32 %7, 4
%16 = add nuw nsw i64 %6, 2
%17 = icmp eq i64 %16, 16
br i1 %17, label %18, label %5
18: ; preds = %5
%19 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 15
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
%22 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 14
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 13
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
%28 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 12
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
%31 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 11
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
%34 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 10
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 0
%37 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 9
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
%40 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 1
%41 = bitcast i32* %40 to <8 x i32>*
%42 = load <8 x i32>, <8 x i32>* %41
%43 = icmp eq <8 x i32> %42, zeroinitializer
%44 = tail call i32 @pow(i32 2, i32 0)
%45 = select i1 %21, i32 %44, i32 0
%46 = tail call i32 @pow(i32 2, i32 1)
%47 = select i1 %24, i32 %46, i32 0
%48 = tail call i32 @pow(i32 2, i32 2)
%49 = select i1 %27, i32 %48, i32 0
%50 = tail call i32 @pow(i32 2, i32 3)
%51 = select i1 %30, i32 %50, i32 0
%52 = tail call i32 @pow(i32 2, i32 4)
%53 = select i1 %33, i32 %52, i32 0
%54 = tail call i32 @pow(i32 2, i32 5)
%55 = select i1 %36, i32 %54, i32 0
%56 = tail call i32 @pow(i32 2, i32 6)
%57 = select i1 %39, i32 %56, i32 0
%58 = tail call i32 @pow(i32 2, i32 7)
%59 = tail call i32 @pow(i32 2, i32 8)
%60 = tail call i32 @pow(i32 2, i32 9)
%61 = tail call i32 @pow(i32 2, i32 10)
%62 = tail call i32 @pow(i32 2, i32 11)
%63 = tail call i32 @pow(i32 2, i32 12)
%64 = tail call i32 @pow(i32 2, i32 13)
%65 = tail call i32 @pow(i32 2, i32 14)
%66 = insertelement <8 x i32> poison, i32 %65, i64 0
%67 = insertelement <8 x i32> %66, i32 %64, i64 1
%68 = insertelement <8 x i32> %67, i32 %63, i64 2
%69 = insertelement <8 x i32> %68, i32 %62, i64 3
%70 = insertelement <8 x i32> %69, i32 %61, i64 4
%71 = insertelement <8 x i32> %70, i32 %60, i64 5
%72 = insertelement <8 x i32> %71, i32 %59, i64 6
%73 = insertelement <8 x i32> %72, i32 %58, i64 7
%74 = select <8 x i1> %43, <8 x i32> %73, <8 x i32> zeroinitializer
%75 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %74)
%76 = add nsw i32 %75, %57
%77 = add nsw i32 %76, %55
%78 = add nsw i32 %77, %53
%79 = add nsw i32 %78, %51
%80 = add nsw i32 %79, %49
%81 = add nsw i32 %80, %47
%82 = add nsw i32 %81, %45
%83 = sub nsw i32 0, %82
ret i32 %83
}