#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
void reg3(void) {
  uint32_t reg3 = 0;
  printf("\ninput reg3: ");
  if (scanf("%x", &reg3)) {
    printf("VCO: %u \n", (reg3 & (0x3F << 26)) >> 26);
    printf("CDIV: %u \n", (reg3 & (0xFFF << 3)) >> 3);
  }
}


x86 assembly (clang, -O0):
<reg3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     118b <reg3+0x6b>
mov    -0x4(%rbp),%esi
and    $0xfc000000,%esi
sar    $0x1a,%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
and    $0x7ff8,%esi
sar    $0x3,%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg3>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     117d <reg3+0x5d>
mov    0x4(%rsp),%esi
sar    $0x1a,%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
shr    $0x3,%esi
and    $0xfff,%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0Ainput reg3: \00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [10 x i8] c"VCO: %u \0A\00"
@.str.3 = [11 x i8] c"CDIV: %u \0A\00"
define void @reg3() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = load i32, i32* %1
%7 = and i32 %6, -67108864
%8 = ashr i32 %7, 26
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = and i32 %10, 32760
%12 = ashr i32 %11, 3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0Ainput reg3: \00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [10 x i8] c"VCO: %u \0A\00"
@.str.3 = [11 x i8] c"CDIV: %u \0A\00"
define void @reg3() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0
%7 = load i32, i32* %1
%8 = ashr i32 %7, 26
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = lshr i32 %10, 3
%12 = and i32 %11, 4095
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %6, %0
ret void
}