#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 */
typedef int int32_t;

/* Variables and functions */
float atof(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ round(float);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int j = 0x004AB20;
  printf("j=%X", (j & 0x0040020));
  if (argc < 2) {
    fprintf(stderr, "usage %s <x>\n", argv[0]);
    exit(2);
  }
  float x = atof(argv[1]);
  printf("x= 0x%08X \n", (int32_t)round(x * (1 << 28)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4ab20,-0x14(%rbp)
mov    -0x14(%rbp),%esi
and    $0x40020,%esi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    11b2 <main+0x62>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe66(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x18(%rbp)
movss  0xe34(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
call   1060 <round@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea5(%rip),%rdi
mov    $0x40020,%esi
call   1040 <printf@plt>
cmp    $0x1,%ebp
jle    119b <main+0x4b>
mov    0x8(%rbx),%rdi
call   1030 <atof@plt>
mulss  0xe81(%rip),%xmm0
call   1060 <round@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe5b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"j=%X\00"
@stderr = global i32 0
@.str.1 = [14 x i8] c"usage %s <x>\0A\00"
@.str.2 = [12 x i8] c"x= 0x%08X \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 305952, i32* %6
%8 = load i32, i32* %6
%9 = and i32 %8, 262176
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 2)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call float @atof(i8* %23)
store float %24, float* %7
%25 = load float, float* %7
%26 = fmul float %25, 0x41B0000000000000
%27 = call i64 @round(float %26)
%28 = trunc i64 %27 to i32
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"j=%X\00"
@stderr = global i32 0
@.str.1 = [14 x i8] c"usage %s <x>\0A\00"
@.str.2 = [12 x i8] c"x= 0x%08X \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 262176)
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 2)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call float @atof(i8* %12)
%14 = fmul float %13, 0x41B0000000000000
%15 = tail call i64 @round(float %14)
%16 = trunc i64 %15 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret i32 0
}