void test_array() {
  char a[] = "abc";
  typeof(a) b = "de";
  fexpect_string("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/"
                 "test/input/8cc/typeof.c",
                 15, "de", 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/input/8cc/"
          "typeof.c",
          16, 4, sizeof(b));
  ;
  typeof(typeof(char *)[4]) y;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/input/8cc/"
          "typeof.c",
          19, 4, sizeof(y) / sizeof(*y));
  ;
  typedef typeof(a[0]) CHAR;
  CHAR z = 'z';
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/input/8cc/"
          "typeof.c",
          23, 'z', z);
  ;
}


x86 assembly (clang, -O0):
<test_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xf5b(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rcx
lea    0xebf(%rip),%rdi
mov    $0xf,%esi
lea    0xf3e(%rip),%rdx
mov    $0x0,%al
call   1030 <fexpect_string@plt>
lea    0xea5(%rip),%rdi
mov    $0x10,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
mov    $0x0,%al
call   1040 <fexpect@plt>
lea    0xe88(%rip),%rdi
mov    $0x13,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
mov    $0x0,%al
call   1040 <fexpect@plt>
movb   $0x7a,-0x31(%rbp)
movsbl -0x31(%rbp),%ecx
lea    0xe63(%rip),%rdi
mov    $0x17,%esi
mov    $0x7a,%edx
mov    $0x0,%al
call   1040 <fexpect@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_array>:
push   %rbx
sub    $0x10,%rsp
movl   $0x6564,0xc(%rsp)
lea    0xecc(%rip),%rbx
lea    0xf50(%rip),%rdx
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1030 <fexpect_string@plt>
mov    $0x4,%ecx
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <fexpect@plt>
mov    $0x4,%ecx
mov    %rbx,%rdi
mov    $0x13,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <fexpect@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
mov    $0x7a,%edx
mov    $0x7a,%ecx
xor    %eax,%eax
call   1040 <fexpect@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_array.a = [4 x i8] c"abc\00"
@__const.test_array.b = [4 x i8] c"de\00\00"
@.str = [139 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/input/8cc/typeof.c\00"
@.str.1 = [3 x i8] c"de\00"
define void @test_array() {
%1 = alloca [4 x i8]
%2 = alloca [4 x i8]
%3 = alloca [4 x i8*]
%4 = alloca i8
%5 = bitcast [4 x i8]* %1 to i8*
%6 = bitcast [4 x i8]* %2 to i8*
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @fexpect_string to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, i32, i32, i64, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i64, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 16, i32 4, i64 4)
%10 = call i32 (i8*, i32, i32, i64, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i64, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 19, i32 4, i64 4)
store i8 122, i8* %4
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 23, i32 122, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [139 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/input/8cc/typeof.c\00"
@.str.1 = [3 x i8] c"de\00"
define void @test_array() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 25956, i32* %1
%3 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @fexpect_string to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = call i32 (i8*, i32, i32, i64, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i64, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 16, i32 4, i64 4)
%5 = call i32 (i8*, i32, i32, i64, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i64, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 19, i32 4, i64 4)
%6 = call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 23, i32 122, i32 122)
ret void
}