#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 /*<<< orphan*/ scanf(char *, ...);
int main() {
  int a;
  double b, c;
  printf("Enter an integer a = ");
  scanf("%d", &a);
  if (a > 500 || a < 0) {
    printf("The %d must be between 0 <= a <= 500", a);
    return 1;
  }
  printf("Enter double b = ");
  scanf("%lf", &b);
  printf("Enter double c = ");
  scanf("%lf", &c);
  int num = a, i = 9;
  char numAsString[] = "0000000000";
  while (num > 0) {
    int bit = num % 2;
    numAsString[i] = bit ? '1' : '0';
    num /= 2;
    i--;
  }
  printf("|%-10X|%s|%10.2f|%-10.3f|\n", a, numAsString, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1f4,-0x8(%rbp)
jg     1166 <main+0x46>
cmpl   $0x0,-0x8(%rbp)
jge    1183 <main+0x63>
mov    -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1266 <main+0x146>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x9,-0x20(%rbp)
mov    0xe8f(%rip),%rax
mov    %rax,-0x2b(%rbp)
mov    0xe8c(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe84(%rip),%al
mov    %al,-0x21(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1240 <main+0x120>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
mov    -0x30(%rbp),%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x2b(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11ef <main+0xcf>
mov    -0x8(%rbp),%esi
lea    -0x2b(%rbp),%rdx
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe19(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x1f5,%esi
jb     116d <main+0x4d>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
jmp    1216 <main+0xf6>
lea    0xeca(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%r14
lea    0x28(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
movabs $0x3030303030303030,%rax
30 30 30
mov    %rax,0x10(%rsp)
movl   $0x303030,0x17(%rsp)
test   %esi,%esi
jle    11f7 <main+0xd7>
lea    0x19(%rsp),%rax
mov    %esi,%edx
mov    %esi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ebx
and    $0x1,%bl
or     $0x30,%bl
mov    %bl,(%rax)
shr    %ecx
add    $0xffffffffffffffff,%rax
cmp    $0x1,%edx
mov    %ecx,%edx
ja     11e0 <main+0xc0>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
lea    0xe67(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    $0x2,%al
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter an integer a = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"The %d must be between 0 <= a <= 500\00"
@.str.3 = [18 x i8] c"Enter double b = \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [18 x i8] c"Enter double c = \00"
@__const.main.numAsString = [11 x i8] c"0000000000\00"
@.str.6 = [27 x i8] c"|%-10X|%s|%10.2f|%-10.3f|\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca [11 x i8]
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 500
br i1 %12, label %16, label %13
13: ; preds = %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13, %0
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %17)
store i32 1, i32* %1
br label %50
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %4)
%24 = load i32, i32* %2
store i32 %24, i32* %5
store i32 9, i32* %6
%25 = bitcast [11 x i8]* %7 to i8*
br label %26
26: ; preds = %29, %19
%27 = load i32, i32* %5
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %44
29: ; preds = %26
%30 = load i32, i32* %5
%31 = srem i32 %30, 2
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = icmp ne i32 %32, 0
%34 = zext i1 %33 to i64
%35 = select i1 %33, i32 49, i32 48
%36 = trunc i32 %35 to i8
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 %38
store i8 %36, i8* %39
%40 = load i32, i32* %5
%41 = sdiv i32 %40, 2
store i32 %41, i32* %5
%42 = load i32, i32* %6
%43 = add nsw i32 %42, -1
store i32 %43, i32* %6
br label %26
44: ; preds = %26
%45 = load i32, i32* %2
%46 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%47 = load double, double* %3
%48 = load double, double* %4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %45, i8* %46, double %47, double %48)
store i32 0, i32* %1
br label %50
50: ; preds = %44, %16
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter an integer a = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"The %d must be between 0 <= a <= 500\00"
@.str.3 = [18 x i8] c"Enter double b = \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [18 x i8] c"Enter double c = \00"
@__const.main.numAsString = [11 x i8] c"0000000000\00"
@.str.6 = [27 x i8] c"|%-10X|%s|%10.2f|%-10.3f|\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca [11 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp ugt i32 %10, 500
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %36
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
%19 = load i32, i32* %1
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%21 = icmp sgt i32 %19, 0
br i1 %21, label %22, label %32
22: ; preds = %14, %22
%23 = phi i64 [ %30, %22 ], [ 9, %14 ]
%24 = phi i32 [ %29, %22 ], [ %19, %14 ]
%25 = trunc i32 %24 to i8
%26 = and i8 %25, 1
%27 = or i8 %26, 48
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %23
store i8 %27, i8* %28
%29 = lshr i32 %24, 1
%30 = add nsw i64 %23, -1
%31 = icmp ult i32 %24, 2
br i1 %31, label %32, label %22
32: ; preds = %22, %14
%33 = load double, double* %2
%34 = load double, double* %3
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %19, i8* %20, double %33, double %34)
br label %36
36: ; preds = %32, %12
%37 = phi i32 [ 1, %12 ], [ 0, %32 ]
ret i32 %37
}