#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 lower_bits(int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int x = 0x78ABCDEF;
  int s6 = 6;
  int s1 = 1;
  int s17 = 17;
  int s32 = 32;
  printf("x is %x:\n", x);
  printf("n is %d and result is %x\n", s6, lower_bits(x, s6));
  printf("n is %d and result is %x\n", s1, lower_bits(x, s1));
  printf("n is %d and result is %x\n", s17, lower_bits(x, s17));
  printf("n is %d and result is %x\n", s32, lower_bits(x, s32));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x78abcdef,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x11,-0x14(%rbp)
movl   $0x20,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <lower_bits@plt>
mov    -0x28(%rbp),%esi
mov    %eax,%edx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <lower_bits@plt>
mov    -0x24(%rbp),%esi
mov    %eax,%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <lower_bits@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <lower_bits@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x78abcdef,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x78abcdef,%edi
mov    $0x6,%esi
call   1040 <lower_bits@plt>
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x78abcdef,%edi
mov    $0x1,%esi
call   1040 <lower_bits@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x78abcdef,%edi
mov    $0x11,%esi
call   1040 <lower_bits@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x78abcdef,%edi
mov    $0x20,%esi
call   1040 <lower_bits@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"x is %x:\0A\00"
@.str.1 = [26 x i8] c"n is %d and result is %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 2024525295, i32* %2
store i32 6, i32* %3
store i32 1, i32* %4
store i32 17, i32* %5
store i32 32, i32* %6
%7 = load i32, i32* %2
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @lower_bits(i32 %10, i32 %11)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = call i32 @lower_bits(i32 %15, i32 %16)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %2
%21 = load i32, i32* %5
%22 = call i32 @lower_bits(i32 %20, i32 %21)
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %2
%26 = load i32, i32* %6
%27 = call i32 @lower_bits(i32 %25, i32 %26)
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"x is %x:\0A\00"
@.str.1 = [26 x i8] c"n is %d and result is %x\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2024525295)
%2 = tail call i32 @lower_bits(i32 2024525295, i32 6)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %2)
%4 = tail call i32 @lower_bits(i32 2024525295, i32 1)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %4)
%6 = tail call i32 @lower_bits(i32 2024525295, i32 17)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 17, i32 %6)
%8 = tail call i32 @lower_bits(i32 2024525295, i32 32)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 32, i32 %8)
ret i32 0
}