#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*/ fexpect(char *, int, int, int);
void bitfield_union() {
  union {
    int a : 10;
    char b : 5;
    char c : 5;
  } x;
  x.a = 2;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          229, 2, x.a);
  ;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          230, 2, x.b);
  ;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c",
          231, 2, x.c);
  ;
}


x86 assembly (clang, -O0):
<bitfield_union>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%ax
and    $0xfc00,%ax
or     $0x2,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
shl    $0x6,%ax
sar    $0x6,%ax
movswl %ax,%ecx
lea    0xec2(%rip),%rdi
mov    $0xe5,%esi
mov    $0x2,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%al
shl    $0x3,%al
sar    $0x3,%al
movsbl %al,%ecx
lea    0xea0(%rip),%rdi
mov    $0xe6,%esi
mov    $0x2,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%al
shl    $0x3,%al
sar    $0x3,%al
movsbl %al,%ecx
lea    0xe7e(%rip),%rdi
mov    $0xe7,%esi
mov    $0x2,%edx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfield_union>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xe5,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xe6,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xe7,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
%union.anon = type { i16, [2 x i8] }
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @bitfield_union() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i16*
%3 = load i16, i16* %2
%4 = and i16 %3, -1024
%5 = or i16 %4, 2
store i16 %5, i16* %2
%6 = bitcast %union.anon* %1 to i16*
%7 = load i16, i16* %6
%8 = shl i16 %7, 6
%9 = ashr i16 %8, 6
%10 = sext i16 %9 to i32
%11 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 229, i32 2, i32 %10)
%12 = bitcast %union.anon* %1 to i8*
%13 = load i8, i8* %12
%14 = shl i8 %13, 3
%15 = ashr i8 %14, 3
%16 = sext i8 %15 to i32
%17 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 230, i32 2, i32 %16)
%18 = bitcast %union.anon* %1 to i8*
%19 = load i8, i8* %18
%20 = shl i8 %19, 3
%21 = ashr i8 %20, 3
%22 = sext i8 %21 to i32
%23 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 231, i32 2, i32 %22)
ret void
}

LLVM IR (-O2):
@.str = [129 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/struct.c\00"
define void @bitfield_union() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 229, i32 2, i32 2)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 230, i32 2, i32 2)
%3 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 231, i32 2, i32 2)
ret void
}