#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_sdram_2(void) {
  uint32_t insn;
  printf("SDRAM test 2: \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",
        292, (dbg_wb_write32(0x00000000 + 0x00, 0x12345678)));
  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",
        293, (dbg_wb_read32(0x00000000 + 0x00, &insn)));
  printf("expected %x, read %x\n", 0x12345678, insn);
  if (insn != 0x12345678)
    return 0x0800;
  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",
        297, (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",
        298, (dbg_wb_read32(0x00000000 + 0x0000, &insn)));
  printf("expected %x, read %x\n", 0x11112222, insn);
  if (insn != 0x11112222)
    return 0x0800;
  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",
        302, (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",
        303, (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",
        304, (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",
        305, (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",
        306, (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",
        307, (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",
        308, (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",
        309, (dbg_wb_write32(0x00000000 + 0x0020, 0xdeadbeef)));
  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",
        311, (dbg_wb_read32(0x00000000 + 0x0000, &insn)));
  printf("expected %x, read %x\n", 0x11112222, insn);
  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",
        313, (dbg_wb_read32(0x00000000 + 0x0004, &insn)));
  printf("expected %x, read %x\n", 0x33334444, insn);
  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",
        315, (dbg_wb_read32(0x00000000 + 0x0008, &insn)));
  printf("expected %x, read %x\n", 0x55556666, insn);
  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",
        317, (dbg_wb_read32(0x00000000 + 0x000c, &insn)));
  printf("expected %x, read %x\n", 0x77778888, insn);
  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",
        319, (dbg_wb_read32(0x00000000 + 0x0010, &insn)));
  printf("expected %x, read %x\n", 0x9999aaaa, insn);
  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",
        321, (dbg_wb_read32(0x00000000 + 0x0014, &insn)));
  printf("expected %x, read %x\n", 0xbbbbcccc, insn);
  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",
        323, (dbg_wb_read32(0x00000000 + 0x0018, &insn)));
  printf("expected %x, read %x\n", 0xddddeeee, insn);
  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",
        325, (dbg_wb_read32(0x00000000 + 0x001c, &insn)));
  printf("expected %x, read %x\n", 0xffff0000, insn);
  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",
        327, (dbg_wb_read32(0x00000000 + 0x0020, &insn)));
  printf("expected %x, read %x\n", 0xdeadbeef, insn);
  if (insn != 0xdeadbeef) {
    printf("SDRAM test 2 FAILED\n");
    return 0x0800;
  } else
    printf("SDRAM test 2 passed\n");
  return 0x0;
}


x86 assembly (clang, -O0):
<test_sdram_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x12345678,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xea5(%rip),%rdi
mov    $0x124,%esi
call   1060 <check@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xe87(%rip),%rdi
mov    $0x125,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xf34(%rip),%rdi
mov    $0x12345678,%esi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x12345678,-0x8(%rbp)
je     11c2 <test_sdram_2+0x82>
movl   $0x800,-0x4(%rbp)
jmp    1566 <test_sdram_2+0x426>
xor    %edi,%edi
mov    $0x11112222,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xe39(%rip),%rdi
mov    $0x129,%esi
call   1060 <check@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xe1b(%rip),%rdi
mov    $0x12a,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xec8(%rip),%rdi
mov    $0x11112222,%esi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x11112222,-0x8(%rbp)
je     122e <test_sdram_2+0xee>
movl   $0x800,-0x4(%rbp)
jmp    1566 <test_sdram_2+0x426>
mov    $0x4,%edi
mov    $0x33334444,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xdca(%rip),%rdi
mov    $0x12e,%esi
call   1060 <check@plt>
mov    $0x8,%edi
mov    $0x55556666,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xda8(%rip),%rdi
mov    $0x12f,%esi
call   1060 <check@plt>
mov    $0xc,%edi
mov    $0x77778888,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd86(%rip),%rdi
mov    $0x130,%esi
call   1060 <check@plt>
mov    $0x10,%edi
mov    $0x9999aaaa,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd64(%rip),%rdi
mov    $0x131,%esi
call   1060 <check@plt>
mov    $0x14,%edi
mov    $0xbbbbcccc,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd42(%rip),%rdi
mov    $0x132,%esi
call   1060 <check@plt>
mov    $0x18,%edi
mov    $0xddddeeee,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xd20(%rip),%rdi
mov    $0x133,%esi
call   1060 <check@plt>
mov    $0x1c,%edi
mov    $0xffff0000,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xcfe(%rip),%rdi
mov    $0x134,%esi
call   1060 <check@plt>
mov    $0x20,%edi
mov    $0xdeadbeef,%esi
call   1050 <dbg_wb_write32@plt>
mov    %eax,%edx
lea    0xcdc(%rip),%rdi
mov    $0x135,%esi
call   1060 <check@plt>
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <dbg_wb_read32@plt>
mov    %eax,%edx
lea    0xcbe(%rip),%rdi
mov    $0x137,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xd6b(%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    0xc87(%rip),%rdi
mov    $0x139,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xd34(%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    0xc50(%rip),%rdi
mov    $0x13b,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xcfd(%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    0xc19(%rip),%rdi
mov    $0x13d,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xcc6(%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    0xbe2(%rip),%rdi
mov    $0x13f,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc8f(%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    0xbab(%rip),%rdi
mov    $0x141,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc58(%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    0xb74(%rip),%rdi
mov    $0x143,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xc21(%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    0xb3d(%rip),%rdi
mov    $0x145,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xbea(%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    0xb06(%rip),%rdi
mov    $0x147,%esi
call   1060 <check@plt>
mov    -0x8(%rbp),%edx
lea    0xbb3(%rip),%rdi
mov    $0xdeadbeef,%esi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xdeadbeef,-0x8(%rbp)
je     1551 <test_sdram_2+0x411>
lea    0xba9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x800,-0x4(%rbp)
jmp    1566 <test_sdram_2+0x426>
lea    0xba4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sdram_2>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x12345678,%esi
call   1060 <dbg_wb_write32@plt>
lea    0xe88(%rip),%rbx
mov    %rbx,%rdi
mov    $0x124,%esi
mov    %eax,%edx
call   1070 <check@plt>
lea    0xc(%rsp),%rsi
xor    %edi,%edi
call   1040 <dbg_wb_read32@plt>
mov    %rbx,%rdi
mov    $0x125,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
lea    0xf14(%rip),%rdi
mov    $0x12345678,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x800,%ebx
cmpl   $0x12345678,0xc(%rsp)
12
jne    14fc <test_sdram_2+0x3ac>
xor    %edi,%edi
mov    $0x11112222,%esi
call   1060 <dbg_wb_write32@plt>
lea    0xe21(%rip),%r14
mov    %r14,%rdi
mov    $0x129,%esi
mov    %eax,%edx
call   1070 <check@plt>
lea    0xc(%rsp),%rsi
xor    %edi,%edi
call   1040 <dbg_wb_read32@plt>
mov    %r14,%rdi
mov    $0x12a,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
lea    0xead(%rip),%rdi
mov    $0x11112222,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x11112222,0xc(%rsp)
11
jne    14fc <test_sdram_2+0x3ac>
mov    $0x4,%edi
mov    $0x33334444,%esi
call   1060 <dbg_wb_write32@plt>
lea    0xdbc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x12e,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x8,%edi
mov    $0x55556666,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x12f,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0xc,%edi
mov    $0x77778888,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x130,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x10,%edi
mov    $0x9999aaaa,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x131,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x14,%edi
mov    $0xbbbbcccc,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x132,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x18,%edi
mov    $0xddddeeee,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x133,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x1c,%edi
mov    $0xffff0000,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x134,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    $0x20,%edi
mov    $0xdeadbeef,%esi
call   1060 <dbg_wb_write32@plt>
mov    %rbx,%rdi
mov    $0x135,%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    $0x137,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
lea    0xd73(%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    $0x139,%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    $0x13b,%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    $0x13d,%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    $0x13f,%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    $0x141,%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    $0x143,%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    $0x145,%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    $0x147,%esi
mov    %eax,%edx
call   1070 <check@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0xdeadbeef,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %ebx,%ebx
cmpl   $0xdeadbeef,0xc(%rsp)
de
setne  %bl
lea    0xbfd(%rip),%rax
lea    0xc0a(%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 = [16 x i8] c"SDRAM test 2: \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"SDRAM test 2 FAILED\0A\00"
@.str.4 = [21 x i8] c"SDRAM test 2 passed\0A\00"
define i32 @test_sdram_2() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @dbg_wb_write32(i32 0, i32 305419896)
%5 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 292, i32 %4)
%6 = call i32 @dbg_wb_read32(i32 0, i32* %2)
%7 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 293, i32 %6)
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 305419896, i32 %8)
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 305419896
br i1 %11, label %12, label %13
12: ; preds = %0
store i32 2048, i32* %1
br label %83
13: ; preds = %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 297, i32 %14)
%16 = call i32 @dbg_wb_read32(i32 0, i32* %2)
%17 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 298, i32 %16)
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 286335522, i32 %18)
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 286335522
br i1 %21, label %22, label %23
22: ; preds = %13
store i32 2048, i32* %1
br label %83
23: ; preds = %13
%24 = call i32 @dbg_wb_write32(i32 4, i32 858997828)
%25 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 302, i32 %24)
%26 = call i32 @dbg_wb_write32(i32 8, i32 1431660134)
%27 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 303, i32 %26)
%28 = call i32 @dbg_wb_write32(i32 12, i32 2004322440)
%29 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 304, i32 %28)
%30 = call i32 @dbg_wb_write32(i32 16, i32 -1717982550)
%31 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 305, i32 %30)
%32 = call i32 @dbg_wb_write32(i32 20, i32 -1145320244)
%33 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 306, i32 %32)
%34 = call i32 @dbg_wb_write32(i32 24, i32 -572657938)
%35 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 307, i32 %34)
%36 = call i32 @dbg_wb_write32(i32 28, i32 -65536)
%37 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 308, i32 %36)
%38 = call i32 @dbg_wb_write32(i32 32, i32 -559038737)
%39 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 309, i32 %38)
%40 = call i32 @dbg_wb_read32(i32 0, i32* %2)
%41 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 311, 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 286335522, i32 %42)
%44 = call i32 @dbg_wb_read32(i32 4, i32* %2)
%45 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 313, 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 858997828, i32 %46)
%48 = call i32 @dbg_wb_read32(i32 8, i32* %2)
%49 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 315, 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 1431660134, i32 %50)
%52 = call i32 @dbg_wb_read32(i32 12, i32* %2)
%53 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 317, 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 2004322440, i32 %54)
%56 = call i32 @dbg_wb_read32(i32 16, i32* %2)
%57 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 319, 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 -1717982550, i32 %58)
%60 = call i32 @dbg_wb_read32(i32 20, i32* %2)
%61 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 321, 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 -1145320244, i32 %62)
%64 = call i32 @dbg_wb_read32(i32 24, i32* %2)
%65 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 323, 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 -572657938, i32 %66)
%68 = call i32 @dbg_wb_read32(i32 28, i32* %2)
%69 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 325, i32 %68)
%70 = load i32, i32* %2
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -65536, i32 %70)
%72 = call i32 @dbg_wb_read32(i32 32, i32* %2)
%73 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 327, i32 %72)
%74 = load i32, i32* %2
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -559038737, i32 %74)
%76 = load i32, i32* %2
%77 = icmp ne i32 %76, -559038737
br i1 %77, label %78, label %80
78: ; preds = %23
%79 = 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 %83
80: ; preds = %23
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %82
82: ; preds = %80
store i32 0, i32* %1
br label %83
83: ; preds = %82, %78, %22, %12
%84 = load i32, i32* %1
ret i32 %84
}

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 = [15 x i8] c"SDRAM test 2: \00"
@str.5 = [20 x i8] c"SDRAM test 2 passed\00"
@str.6 = [20 x i8] c"SDRAM test 2 FAILED\00"
define i32 @test_sdram_2() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @dbg_wb_write32(i32 0, i32 305419896)
%5 = tail call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 292, i32 %4)
%6 = call i32 @dbg_wb_read32(i32 0, i32* %1)
%7 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 293, i32 %6)
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 305419896, i32 %8)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 305419896
br i1 %11, label %12, label %79
12: ; preds = %0
%13 = call i32 @dbg_wb_write32(i32 0, i32 286335522)
%14 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 297, i32 %13)
%15 = call i32 @dbg_wb_read32(i32 0, i32* %1)
%16 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 298, i32 %15)
%17 = load i32, i32* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 286335522, i32 %17)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 286335522
br i1 %20, label %21, label %79
21: ; preds = %12
%22 = call i32 @dbg_wb_write32(i32 4, i32 858997828)
%23 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 302, i32 %22)
%24 = call i32 @dbg_wb_write32(i32 8, i32 1431660134)
%25 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 303, i32 %24)
%26 = call i32 @dbg_wb_write32(i32 12, i32 2004322440)
%27 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 304, i32 %26)
%28 = call i32 @dbg_wb_write32(i32 16, i32 -1717982550)
%29 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 305, i32 %28)
%30 = call i32 @dbg_wb_write32(i32 20, i32 -1145320244)
%31 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 306, i32 %30)
%32 = call i32 @dbg_wb_write32(i32 24, i32 -572657938)
%33 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 307, i32 %32)
%34 = call i32 @dbg_wb_write32(i32 28, i32 -65536)
%35 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 308, i32 %34)
%36 = call i32 @dbg_wb_write32(i32 32, i32 -559038737)
%37 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 309, i32 %36)
%38 = call i32 @dbg_wb_read32(i32 0, i32* %1)
%39 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 311, 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 286335522, i32 %40)
%42 = call i32 @dbg_wb_read32(i32 4, i32* %1)
%43 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 313, 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 858997828, i32 %44)
%46 = call i32 @dbg_wb_read32(i32 8, i32* %1)
%47 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 315, 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 1431660134, i32 %48)
%50 = call i32 @dbg_wb_read32(i32 12, i32* %1)
%51 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 317, 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 2004322440, i32 %52)
%54 = call i32 @dbg_wb_read32(i32 16, i32* %1)
%55 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 319, 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 -1717982550, i32 %56)
%58 = call i32 @dbg_wb_read32(i32 20, i32* %1)
%59 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 321, i32 %58)
%60 = load i32, i32* %1
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -1145320244, i32 %60)
%62 = call i32 @dbg_wb_read32(i32 24, i32* %1)
%63 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 323, i32 %62)
%64 = load i32, i32* %1
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -572657938, i32 %64)
%66 = call i32 @dbg_wb_read32(i32 28, i32* %1)
%67 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 325, i32 %66)
%68 = load i32, i32* %1
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -65536, i32 %68)
%70 = call i32 @dbg_wb_read32(i32 32, i32* %1)
%71 = call i32 @check(i8* getelementptr inbounds ([193 x i8], [193 x i8]* @.str.1, i64 0, i64 0), i32 327, i32 %70)
%72 = load i32, i32* %1
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 -559038737, i32 %72)
%74 = load i32, i32* %1
%75 = icmp eq i32 %74, -559038737
%76 = select i1 %75, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0)
%77 = select i1 %75, i32 0, i32 2048
%78 = call i32 @puts(i8* dereferenceable(1) %76)
br label %79
79: ; preds = %21, %12, %0
%80 = phi i32 [ 2048, %0 ], [ 2048, %12 ], [ %77, %21 ]
ret i32 %80
}