#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*/ dec2bin(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int x = 100;
  int y = 6;
  int z = x & y;
  char x_str[25];
  char y_str[25];
  char z_str[25];
  dec2bin(x, x_str);
  printf("x 二进制值为：%s\n", x_str);
  dec2bin(y, y_str);
  printf("y 二进制值为：%s\n", y_str);
  dec2bin(z, z_str);
  printf("z 二进制值为：%s\n", z_str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1040 <dec2bin@plt>
lea    -0x30(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1040 <dec2bin@plt>
lea    -0x50(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
lea    -0x70(%rbp),%rsi
call   1040 <dec2bin@plt>
lea    -0x70(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0x40(%rsp),%rbx
mov    $0x64,%edi
mov    %rbx,%rsi
call   1040 <dec2bin@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x20(%rsp),%rbx
mov    $0x6,%edi
mov    %rbx,%rsi
call   1040 <dec2bin@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    $0x4,%edi
mov    %rbx,%rsi
call   1040 <dec2bin@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"x \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
@.str.1 = [24 x i8] c"y \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
@.str.2 = [24 x i8] c"z \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [25 x i8]
%6 = alloca [25 x i8]
%7 = alloca [25 x i8]
store i32 0, i32* %1
store i32 100, i32* %2
store i32 6, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = and i32 %8, %9
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%13 = call i32 @dec2bin(i32 %11, i8* %12)
%14 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %3
%17 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%18 = call i32 @dec2bin(i32 %16, i8* %17)
%19 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %4
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%23 = call i32 @dec2bin(i32 %21, i8* %22)
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"x \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
@.str.1 = [24 x i8] c"y \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
@.str.2 = [24 x i8] c"z \E4\BA\8C\E8\BF\9B\E5\88\B6\E5\80\BC\E4\B8\BA\EF\BC\9A%s\0A\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [25 x i8]
%3 = alloca [25 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%7 = call i32 @dec2bin(i32 100, i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = call i32 @dec2bin(i32 6, i8* %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @dec2bin(i32 4, i8* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}