#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_unnamed() {
  union {
    int i;
    struct {
      char a : 4;
      char b : 4;
      char : 8;
    };
  } x = {0};
  x.i = 0;
  x.a = 2;
  x.b = 4;
  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",
          242, 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",
          243, 4, 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",
          244, 66, x.i);
  ;
  union {
    int i;
    struct {
      char a : 4;
      char : 0;
      char b : 4;
    };
  } y = {0};
  y.a = 2;
  y.b = 4;
  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",
          252, 2, y.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",
          253, 4, y.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",
          254, 1026, y.i);
  ;
}


x86 assembly (clang, -O0):
<bitfield_unnamed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%ax
and    $0xfff0,%ax
or     $0x2,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
and    $0xff0f,%ax
or     $0x40,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
shl    $0xc,%ax
sar    $0xc,%ax
movsbl %al,%ecx
lea    0xe8b(%rip),%rdi
mov    $0xf2,%esi
mov    $0x2,%edx
call   1040 <fexpect@plt>
mov    -0x8(%rbp),%ax
shl    $0x8,%ax
sar    $0xc,%ax
movsbl %al,%ecx
lea    0xe66(%rip),%rdi
mov    $0xf3,%esi
mov    $0x4,%edx
call   1040 <fexpect@plt>
mov    -0x8(%rbp),%ecx
lea    0xe4d(%rip),%rdi
mov    $0xf4,%esi
mov    $0x42,%edx
call   1040 <fexpect@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%al
and    $0xf0,%al
or     $0x2,%al
mov    %al,-0x10(%rbp)
mov    -0xf(%rbp),%al
and    $0xf0,%al
or     $0x4,%al
mov    %al,-0xf(%rbp)
mov    -0x10(%rbp),%al
shl    $0x4,%al
sar    $0x4,%al
movsbl %al,%ecx
lea    0xe07(%rip),%rdi
mov    $0xfc,%esi
mov    $0x2,%edx
call   1040 <fexpect@plt>
mov    -0xf(%rbp),%al
shl    $0x4,%al
sar    $0x4,%al
movsbl %al,%ecx
lea    0xde5(%rip),%rdi
mov    $0xfd,%esi
mov    $0x4,%edx
call   1040 <fexpect@plt>
mov    -0x10(%rbp),%ecx
lea    0xdcc(%rip),%rdi
mov    $0xfe,%esi
mov    $0x402,%edx
call   1040 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfield_unnamed>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xf2,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xf3,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xf4,%esi
mov    $0x42,%edx
mov    $0x42,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xfc,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xfd,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xfe,%esi
mov    $0x402,%edx
mov    $0x402,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
%union.anon.0 = type { i32 }
%struct.anon = type { i16 }
%struct.anon.1 = type { i8, 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_unnamed() {
%1 = alloca %union.anon
%2 = alloca %union.anon.0
%3 = bitcast %union.anon* %1 to i8*
%4 = bitcast %union.anon* %1 to i32*
store i32 0, i32* %4
%5 = bitcast %union.anon* %1 to %struct.anon*
%6 = bitcast %struct.anon* %5 to i16*
%7 = load i16, i16* %6
%8 = and i16 %7, -16
%9 = or i16 %8, 2
store i16 %9, i16* %6
%10 = bitcast %union.anon* %1 to %struct.anon*
%11 = bitcast %struct.anon* %10 to i16*
%12 = load i16, i16* %11
%13 = and i16 %12, -241
%14 = or i16 %13, 64
store i16 %14, i16* %11
%15 = bitcast %union.anon* %1 to %struct.anon*
%16 = bitcast %struct.anon* %15 to i16*
%17 = load i16, i16* %16
%18 = shl i16 %17, 12
%19 = ashr i16 %18, 12
%20 = trunc i16 %19 to i8
%21 = sext i8 %20 to i32
%22 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 242, i32 2, i32 %21)
%23 = bitcast %union.anon* %1 to %struct.anon*
%24 = bitcast %struct.anon* %23 to i16*
%25 = load i16, i16* %24
%26 = shl i16 %25, 8
%27 = ashr i16 %26, 12
%28 = trunc i16 %27 to i8
%29 = sext i8 %28 to i32
%30 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 243, i32 4, i32 %29)
%31 = bitcast %union.anon* %1 to i32*
%32 = load i32, i32* %31
%33 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 244, i32 66, i32 %32)
%34 = bitcast %union.anon.0* %2 to i8*
%35 = bitcast %union.anon.0* %2 to %struct.anon.1*
%36 = bitcast %struct.anon.1* %35 to i8*
%37 = load i8, i8* %36
%38 = and i8 %37, -16
%39 = or i8 %38, 2
store i8 %39, i8* %36
%40 = bitcast %union.anon.0* %2 to %struct.anon.1*
%41 = getelementptr inbounds %struct.anon.1, %struct.anon.1* %40, i32 0, i32 1
%42 = load i8, i8* %41
%43 = and i8 %42, -16
%44 = or i8 %43, 4
store i8 %44, i8* %41
%45 = bitcast %union.anon.0* %2 to %struct.anon.1*
%46 = bitcast %struct.anon.1* %45 to i8*
%47 = load i8, i8* %46
%48 = shl i8 %47, 4
%49 = ashr i8 %48, 4
%50 = sext i8 %49 to i32
%51 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 252, i32 2, i32 %50)
%52 = bitcast %union.anon.0* %2 to %struct.anon.1*
%53 = getelementptr inbounds %struct.anon.1, %struct.anon.1* %52, i32 0, i32 1
%54 = load i8, i8* %53
%55 = shl i8 %54, 4
%56 = ashr i8 %55, 4
%57 = sext i8 %56 to i32
%58 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 253, i32 4, i32 %57)
%59 = bitcast %union.anon.0* %2 to i32*
%60 = load i32, i32* %59
%61 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 254, i32 1026, i32 %60)
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_unnamed() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 242, i32 2, i32 2)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 243, i32 4, i32 4)
%3 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 244, i32 66, i32 66)
%4 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 252, i32 2, i32 2)
%5 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 253, i32 4, i32 4)
%6 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 254, i32 1026, i32 1026)
ret void
}