#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*/ check(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ dbg_wb_read32(int, int *);
int /*<<< orphan*/ dbg_wb_write32(int, int);
int /*<<< orphan*/ printf(char *, ...);
int test_sram(void) {
  uint32_t ins;
  uint32_t insn[9];
  insn[0] = 0x11112222;
  insn[1] = 0x33334444;
  insn[2] = 0x55556666;
  insn[3] = 0x77778888;
  insn[4] = 0x9999aaaa;
  insn[5] = 0xbbbbcccc;
  insn[6] = 0xddddeeee;
  insn[7] = 0xffff0000;
  insn[8] = 0xdedababa;
  printf("SRAM test: \n");
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        359, (dbg_wb_write32(0x00000000 + 0x0000, 0x11112222)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        360, (dbg_wb_write32(0x00000000 + 0x0004, 0x33334444)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        361, (dbg_wb_write32(0x00000000 + 0x0008, 0x55556666)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        362, (dbg_wb_write32(0x00000000 + 0x000c, 0x77778888)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        363, (dbg_wb_write32(0x00000000 + 0x0010, 0x9999aaaa)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        364, (dbg_wb_write32(0x00000000 + 0x0014, 0xbbbbcccc)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        365, (dbg_wb_write32(0x00000000 + 0x0018, 0xddddeeee)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        366, (dbg_wb_write32(0x00000000 + 0x001c, 0xffff0000)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        367, (dbg_wb_write32(0x00000000 + 0x0020, 0xdedababa)));
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        370, (dbg_wb_read32(0x00000000 + 0x0000, &ins)));
  printf("expected %x, read %x\n", 0x11112222, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        372, (dbg_wb_read32(0x00000000 + 0x0004, &ins)));
  printf("expected %x, read %x\n", 0x33334444, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        374, (dbg_wb_read32(0x00000000 + 0x0008, &ins)));
  printf("expected %x, read %x\n", 0x55556666, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        376, (dbg_wb_read32(0x00000000 + 0x000c, &ins)));
  printf("expected %x, read %x\n", 0x77778888, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        378, (dbg_wb_read32(0x00000000 + 0x0010, &ins)));
  printf("expected %x, read %x\n", 0x9999aaaa, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        380, (dbg_wb_read32(0x00000000 + 0x0014, &ins)));
  printf("expected %x, read %x\n", 0xbbbbcccc, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        382, (dbg_wb_read32(0x00000000 + 0x0018, &ins)));
  printf("expected %x, read %x\n", 0xddddeeee, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        384, (dbg_wb_read32(0x00000000 + 0x001c, &ins)));
  printf("expected %x, read %x\n", 0xffff0000, ins);
  check("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/"
        "cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c",
        386, (dbg_wb_read32(0x00000000 + 0x0020, &ins)));
  printf("expected %x, read %x\n", 0xdedababa, ins);
  if (ins != 0xdedababa) {
    printf("SRAM test failed!!!\n");
    return 0x0800;
  } else
    printf("SRAM test passed\n");
  return 0x0;
}


x86 assembly (clang, -O0):
<test_sram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x11112222,-0x30(%rbp)
movl   $0x33334444,-0x2c(%rbp)
movl   $0x55556666,-0x28(%rbp)
movl   $0x77778888,-0x24(%rbp)
movl   $0x9999aaaa,-0x20(%rbp)
movl   $0xbbbbcccc,-0x1c(%rbp)
movl   $0xddddeeee,-0x18(%rbp)
movl   $0xffff0000,-0x14(%rbp)
movl   $0xdedababa,-0x10(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x11112222,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xe63(%rip),%rdi
mov    $0x167,%esi
call   1060 <check@plt>
mov    $0x4,%edi
mov    $0x33334444,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xe41(%rip),%rdi
mov    $0x168,%esi
call   1060 <check@plt>
mov    $0x8,%edi
mov    $0x55556666,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xe1f(%rip),%rdi
mov    $0x169,%esi
call   1060 <check@plt>
mov    $0xc,%edi
mov    $0x77778888,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xdfd(%rip),%rdi
mov    $0x16a,%esi
call   1060 <check@plt>
mov    $0x10,%edi
mov    $0x9999aaaa,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xddb(%rip),%rdi
mov    $0x16b,%esi
call   1060 <check@plt>
mov    $0x14,%edi
mov    $0xbbbbcccc,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xdb9(%rip),%rdi
mov    $0x16c,%esi
call   1060 <check@plt>
mov    $0x18,%edi
mov    $0xddddeeee,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd97(%rip),%rdi
mov    $0x16d,%esi
call   1060 <check@plt>
mov    $0x1c,%edi
mov    $0xffff0000,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd75(%rip),%rdi
mov    $0x16e,%esi
call   1060 <check@plt>
mov    $0x20,%edi
mov    $0xdedababa,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd53(%rip),%rdi
mov    $0x16f,%esi
call   1060 <check@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xd35(%rip),%rdi
mov    $0x172,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xde2(%rip),%rdi
mov    $0x11112222,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xcfe(%rip),%rdi
mov    $0x174,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xdab(%rip),%rdi
mov    $0x33334444,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x8,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xcc7(%rip),%rdi
mov    $0x176,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xd74(%rip),%rdi
mov    $0x55556666,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xc,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xc90(%rip),%rdi
mov    $0x178,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xd3d(%rip),%rdi
mov    $0x77778888,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x10,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xc59(%rip),%rdi
mov    $0x17a,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xd06(%rip),%rdi
mov    $0x9999aaaa,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x14,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xc22(%rip),%rdi
mov    $0x17c,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xccf(%rip),%rdi
mov    $0xbbbbcccc,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x18,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xbeb(%rip),%rdi
mov    $0x17e,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc98(%rip),%rdi
mov    $0xddddeeee,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1c,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xbb4(%rip),%rdi
mov    $0x180,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc61(%rip),%rdi
mov    $0xffff0000,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x20,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xb7d(%rip),%rdi
mov    $0x182,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc2a(%rip),%rdi
mov    $0xdedababa,%esi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xdedababa,-0x8(%rbp)
je     14d7 <test_sram+0x397>
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x800,-0x4(%rbp)
jmp    14ec <test_sram+0x3ac>
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sram>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x11112222,%esi
call   1060 <dbg_wb_write32@plt>
lea    0xe88(%rip),%rbx
mov    %rbx,%rdi
mov    $0x167,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x4,%edi
mov    $0x33334444,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x168,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x8,%edi
mov    $0x55556666,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x169,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0xc,%edi
mov    $0x77778888,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16a,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x10,%edi
mov    $0x9999aaaa,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16b,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x14,%edi
mov    $0xbbbbcccc,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16c,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x18,%edi
mov    $0xddddeeee,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16d,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x1c,%edi
mov    $0xffff0000,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16e,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x20,%edi
mov    $0xdedababa,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x16f,%esi
mov    %eax,%edx
call   1070 <check@plt>
lea    0xc(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x172,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
lea    0xe21(%rip),%r15
mov    %r15,%rdi
mov    $0x11112222,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x4,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x174,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0x33334444,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x8,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x176,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0x55556666,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xc,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x178,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0x77778888,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x10,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x17a,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0x9999aaaa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x14,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x17c,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0xbbbbcccc,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x18,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x17e,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0xddddeeee,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1c,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x180,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0xffff0000,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
mov    %r14,%rsi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x182,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0xdedababa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebx,%ebx
cmpl   $0xdedababa,0xc(%rsp)
de
setne  %bl
lea    0xca8(%rip),%rax
lea    0xcb2(%rip),%rdi
cmove  %rax,%rdi
shl    $0xb,%ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"SRAM test: \0A\00"
@.str.1 = [193 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c\00"
@.str.2 = [22 x i8] c"expected %x, read %x\0A\00"
@.str.3 = [21 x i8] c"SRAM test failed!!!\0A\00"
@.str.4 = [18 x i8] c"SRAM test passed\0A\00"
define i32 @test_sram() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i32]
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 0
store i32 286335522, i32* %4
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 1
store i32 858997828, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 2
store i32 1431660134, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 3
store i32 2004322440, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 4
store i32 -1717982550, i32* %8
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 5
store i32 -1145320244, i32* %9
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 6
store i32 -572657938, i32* %10
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 7
store i32 -65536, i32* %11
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 8
store i32 -556090694, i32* %12
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @dbg_wb_write32(i32 0, i32 286335522)
%15 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 359, i32 %14)
%16 = call i32 @dbg_wb_write32(i32 4, i32 858997828)
%17 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 360, i32 %16)
%18 = call i32 @dbg_wb_write32(i32 8, i32 1431660134)
%19 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 361, i32 %18)
%20 = call i32 @dbg_wb_write32(i32 12, i32 2004322440)
%21 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 362, i32 %20)
%22 = call i32 @dbg_wb_write32(i32 16, i32 -1717982550)
%23 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 363, i32 %22)
%24 = call i32 @dbg_wb_write32(i32 20, i32 -1145320244)
%25 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 364, i32 %24)
%26 = call i32 @dbg_wb_write32(i32 24, i32 -572657938)
%27 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 365, i32 %26)
%28 = call i32 @dbg_wb_write32(i32 28, i32 -65536)
%29 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 366, i32 %28)
%30 = call i32 @dbg_wb_write32(i32 32, i32 -556090694)
%31 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 367, i32 %30)
%32 = call i32 @dbg_wb_read32(i32 0, i32* %2)
%33 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 370, i32 %32)
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 286335522, i32 %34)
%36 = call i32 @dbg_wb_read32(i32 4, i32* %2)
%37 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 372, i32 %36)
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 858997828, i32 %38)
%40 = call i32 @dbg_wb_read32(i32 8, i32* %2)
%41 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 374, i32 %40)
%42 = load i32, i32* %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 1431660134, i32 %42)
%44 = call i32 @dbg_wb_read32(i32 12, i32* %2)
%45 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 376, i32 %44)
%46 = load i32, i32* %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 2004322440, i32 %46)
%48 = call i32 @dbg_wb_read32(i32 16, i32* %2)
%49 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 378, i32 %48)
%50 = load i32, i32* %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -1717982550, i32 %50)
%52 = call i32 @dbg_wb_read32(i32 20, i32* %2)
%53 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 380, i32 %52)
%54 = load i32, i32* %2
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -1145320244, i32 %54)
%56 = call i32 @dbg_wb_read32(i32 24, i32* %2)
%57 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 382, i32 %56)
%58 = load i32, i32* %2
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -572657938, i32 %58)
%60 = call i32 @dbg_wb_read32(i32 28, i32* %2)
%61 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 384, i32 %60)
%62 = load i32, i32* %2
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -65536, i32 %62)
%64 = call i32 @dbg_wb_read32(i32 32, i32* %2)
%65 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 386, i32 %64)
%66 = load i32, i32* %2
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -556090694, i32 %66)
%68 = load i32, i32* %2
%69 = icmp ne i32 %68, -556090694
br i1 %69, label %70, label %72
70: ; preds = %0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 2048, i32* %1
br label %75
72: ; preds = %0
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %74
74: ; preds = %72
store i32 0, i32* %1
br label %75
75: ; preds = %74, %70
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
@.str.1 = [193 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/csturton/wirepatch/refs/heads/master/ddr2/cores/adv_debug_sys/Software/adv_jtag_bridge/or32_selftest.c\00"
@.str.2 = [22 x i8] c"expected %x, read %x\0A\00"
@str = [12 x i8] c"SRAM test: \00"
@str.5 = [17 x i8] c"SRAM test passed\00"
@str.6 = [20 x i8] c"SRAM test failed!!!\00"
define i32 @test_sram() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @dbg_wb_write32(i32 0, i32 286335522)
%5 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 359, i32 %4)
%6 = tail call i32 @dbg_wb_write32(i32 4, i32 858997828)
%7 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 360, i32 %6)
%8 = tail call i32 @dbg_wb_write32(i32 8, i32 1431660134)
%9 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 361, i32 %8)
%10 = tail call i32 @dbg_wb_write32(i32 12, i32 2004322440)
%11 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 362, i32 %10)
%12 = tail call i32 @dbg_wb_write32(i32 16, i32 -1717982550)
%13 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 363, i32 %12)
%14 = tail call i32 @dbg_wb_write32(i32 20, i32 -1145320244)
%15 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 364, i32 %14)
%16 = tail call i32 @dbg_wb_write32(i32 24, i32 -572657938)
%17 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 365, i32 %16)
%18 = tail call i32 @dbg_wb_write32(i32 28, i32 -65536)
%19 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 366, i32 %18)
%20 = tail call i32 @dbg_wb_write32(i32 32, i32 -556090694)
%21 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 367, i32 %20)
%22 = call i32 @dbg_wb_read32(i32 0, i32* %1)
%23 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 370, i32 %22)
%24 = load i32, i32* %1
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 286335522, i32 %24)
%26 = call i32 @dbg_wb_read32(i32 4, i32* %1)
%27 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 372, i32 %26)
%28 = load i32, i32* %1
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 858997828, i32 %28)
%30 = call i32 @dbg_wb_read32(i32 8, i32* %1)
%31 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 374, i32 %30)
%32 = load i32, i32* %1
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 1431660134, i32 %32)
%34 = call i32 @dbg_wb_read32(i32 12, i32* %1)
%35 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 376, i32 %34)
%36 = load i32, i32* %1
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 2004322440, i32 %36)
%38 = call i32 @dbg_wb_read32(i32 16, i32* %1)
%39 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 378, i32 %38)
%40 = load i32, i32* %1
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -1717982550, i32 %40)
%42 = call i32 @dbg_wb_read32(i32 20, i32* %1)
%43 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 380, i32 %42)
%44 = load i32, i32* %1
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -1145320244, i32 %44)
%46 = call i32 @dbg_wb_read32(i32 24, i32* %1)
%47 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 382, i32 %46)
%48 = load i32, i32* %1
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -572657938, i32 %48)
%50 = call i32 @dbg_wb_read32(i32 28, i32* %1)
%51 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 384, i32 %50)
%52 = load i32, i32* %1
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -65536, i32 %52)
%54 = call i32 @dbg_wb_read32(i32 32, i32* %1)
%55 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 386, i32 %54)
%56 = load i32, i32* %1
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -556090694, i32 %56)
%58 = load i32, i32* %1
%59 = icmp eq i32 %58, -556090694
%60 = select i1 %59, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0)
%61 = select i1 %59, i32 0, i32 2048
%62 = call i32 @puts(i8* dereferenceable(1) %60)
ret i32 %61
}