#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_mix() {
  union {
    int i;
    struct {
      char a : 5;
      int b : 5;
    };
  } x;
  x.a = 10;
  x.b = 11;
  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",
          221, 10, 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",
          222, 11, 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",
          223, 362, x.i);
  ;
}


x86 assembly (clang, -O0):
<bitfield_mix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%ax
and    $0xffe0,%ax
or     $0xa,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
and    $0xfc1f,%ax
or     $0x160,%ax
mov    %ax,-0x8(%rbp)
mov    -0x8(%rbp),%ax
shl    $0xb,%ax
sar    $0xb,%ax
movsbl %al,%ecx
lea    0xeb2(%rip),%rdi
mov    $0xdd,%esi
mov    $0xa,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%ax
shl    $0x6,%ax
sar    $0xb,%ax
movswl %ax,%ecx
lea    0xe8d(%rip),%rdi
mov    $0xde,%esi
mov    $0xb,%edx
call   1030 <fexpect@plt>
mov    -0x8(%rbp),%ecx
lea    0xe74(%rip),%rdi
mov    $0xdf,%esi
mov    $0x16a,%edx
call   1030 <fexpect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfield_mix>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xdd,%esi
mov    $0xa,%edx
mov    $0xa,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xde,%esi
mov    $0xb,%edx
mov    $0xb,%ecx
call   1030 <fexpect@plt>
mov    %rbx,%rdi
mov    $0xdf,%esi
mov    $0x16a,%edx
mov    $0x16a,%ecx
pop    %rbx
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
%struct.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_mix() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to %struct.anon*
%3 = bitcast %struct.anon* %2 to i16*
%4 = load i16, i16* %3
%5 = and i16 %4, -32
%6 = or i16 %5, 10
store i16 %6, i16* %3
%7 = bitcast %union.anon* %1 to %struct.anon*
%8 = bitcast %struct.anon* %7 to i16*
%9 = load i16, i16* %8
%10 = and i16 %9, -993
%11 = or i16 %10, 352
store i16 %11, i16* %8
%12 = bitcast %union.anon* %1 to %struct.anon*
%13 = bitcast %struct.anon* %12 to i16*
%14 = load i16, i16* %13
%15 = shl i16 %14, 11
%16 = ashr i16 %15, 11
%17 = trunc i16 %16 to i8
%18 = sext i8 %17 to i32
%19 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 221, i32 10, i32 %18)
%20 = bitcast %union.anon* %1 to %struct.anon*
%21 = bitcast %struct.anon* %20 to i16*
%22 = load i16, i16* %21
%23 = shl i16 %22, 6
%24 = ashr i16 %23, 11
%25 = sext i16 %24 to i32
%26 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 222, i32 11, i32 %25)
%27 = bitcast %union.anon* %1 to i32*
%28 = load i32, i32* %27
%29 = call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 223, i32 362, i32 %28)
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_mix() {
%1 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 221, i32 10, i32 10)
%2 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 222, i32 11, i32 11)
%3 = tail call i32 @fexpect(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i32 223, i32 362, i32 362)
ret void
}