#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);
void get_ports(unsigned long n) {
  int octet_count, port_number;
  for (octet_count = 1; octet_count < 9; octet_count++) {
    for (port_number = octet_count * 8; port_number > (octet_count - 1) * 8;
         port_number--) {
      if (n & 1)
        printf("%d\n", port_number);
      n >>= 1;
    }
  }
}


x86 assembly (clang, -O0):
<get_ports>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1198 <get_ports+0x88>
mov    -0xc(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jle    1185 <get_ports+0x75>
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     116b <get_ports+0x5b>
mov    -0x10(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <get_ports+0x26>
jmp    118a <get_ports+0x7a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <get_ports+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ports>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x8,%r14d
lea    0xedb(%rip),%r15
jmp    1142 <get_ports+0x32>
nopw   0x0(%rax,%rax,1)
shr    $0x8,%rbx
add    $0x8,%r14d
cmp    $0x48,%r14d
je     11fb <get_ports+0xeb>
test   $0x1,%bl
jne    1170 <get_ports+0x60>
test   $0x2,%bl
jne    1180 <get_ports+0x70>
test   $0x4,%bl
jne    1191 <get_ports+0x81>
test   $0x8,%bl
jne    11a2 <get_ports+0x92>
test   $0x10,%bl
jne    11b3 <get_ports+0xa3>
test   $0x20,%bl
jne    11c4 <get_ports+0xb4>
test   $0x40,%bl
jne    11d5 <get_ports+0xc5>
test   $0x80,%bl
je     1130 <get_ports+0x20>
jmp    11ea <get_ports+0xda>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
test   $0x2,%bl
je     114c <get_ports+0x3c>
lea    -0x1(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x4,%bl
je     1151 <get_ports+0x41>
lea    -0x2(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x8,%bl
je     1156 <get_ports+0x46>
lea    -0x3(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x10,%bl
je     115b <get_ports+0x4b>
lea    -0x4(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x20,%bl
je     1160 <get_ports+0x50>
lea    -0x5(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x40,%bl
je     1165 <get_ports+0x55>
lea    -0x6(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
test   $0x80,%bl
je     1130 <get_ports+0x20>
lea    -0x7(%r14),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
jmp    1130 <get_ports+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @get_ports(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i64 %0, i64* %2
store i32 1, i32* %3
br label %5
5: ; preds = %31, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 8
store i32 %10, i32* %4
br label %11
11: ; preds = %27, %8
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = mul nsw i32 %14, 8
%16 = icmp sgt i32 %12, %15
br i1 %16, label %17, label %30
17: ; preds = %11
%18 = load i64, i64* %2
%19 = and i64 %18, 1
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %4
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %17
%25 = load i64, i64* %2
%26 = lshr i64 %25, 1
store i64 %26, i64* %2
br label %27
27: ; preds = %24
%28 = load i32, i32* %4
%29 = add nsw i32 %28, -1
store i32 %29, i32* %4
br label %11
30: ; preds = %11
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %5
34: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @get_ports(i64 %0) {
br label %2
2: ; preds = %1, %53
%3 = phi i32 [ 1, %1 ], [ %54, %53 ]
%4 = phi i64 [ %0, %1 ], [ %11, %53 ]
%5 = shl nuw nsw i32 %3, 3
%6 = and i64 %4, 1
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %10
10: ; preds = %8, %2
%11 = lshr i64 %4, 8
%12 = and i64 %4, 2
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = add nsw i32 %5, -1
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %10
%18 = and i64 %4, 4
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = add nsw i32 %5, -2
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %17
%24 = and i64 %4, 8
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = add nsw i32 %5, -3
%28 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %23
%30 = and i64 %4, 16
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = add nsw i32 %5, -4
%34 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %29
%36 = and i64 %4, 32
%37 = icmp eq i64 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = add nsw i32 %5, -5
%40 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %35
%42 = and i64 %4, 64
%43 = icmp eq i64 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = add nsw i32 %5, -6
%46 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %44, %41
%48 = and i64 %4, 128
%49 = icmp eq i64 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = add nsw i32 %5, -7
%52 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %50, %47
%54 = add nuw nsw i32 %3, 1
%55 = icmp eq i32 %54, 9
br i1 %55, label %56, label %2
56: ; preds = %53
ret void
}