#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 copyLSB(int);
int /*<<< orphan*/ printf(char *, int, int, ...);
int main() {
  int a = 7;
  int b = 0;
  int c = copyLSB(a);
  int d = copyLSB(b);
  printf("the LSB of %d is %d, and copy that everywhere to get %d\n", a, 1,
         255);
  printf("leastBitPos(%d) -> %d\n", a, c);
  printf("the LSB of %d is %d, and copy that everywhere to get %d\n", b, 0, 0);
  printf("leastBitPos(%d) -> %d\n", b, d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <copyLSB@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <copyLSB@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x1,%edx
mov    $0xff,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe7b(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x7,%edi
call   1040 <copyLSB@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1040 <copyLSB@plt>
mov    %eax,%r15d
lea    0xebc(%rip),%r14
mov    %r14,%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    $0xff,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"the LSB of %d is %d, and copy that everywhere to get %d\0A\00"
@.str.1 = [23 x i8] c"leastBitPos(%d) -> %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 7, i32* %1
store i32 0, i32* %2
%5 = load i32, i32* %1
%6 = call i32 @copyLSB(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = call i32 @copyLSB(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %1
%10 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %9, i32 1, i32 255)
%11 = load i32, i32* %1
%12 = load i32, i32* %3
%13 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12)
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %14, i32 0, i32 0)
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"the LSB of %d is %d, and copy that everywhere to get %d\0A\00"
@.str.1 = [23 x i8] c"leastBitPos(%d) -> %d\0A\00"
define i32 @main() {
%1 = tail call i32 @copyLSB(i32 7)
%2 = tail call i32 @copyLSB(i32 0)
%3 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 7, i32 1, i32 255)
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %1)
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 0)
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %2)
ret i32 0
}