Task: b-4-var-0-safe (expected: safe)

C source (code.c):
/*  b-4-var-0 — victim (transpilation unit).  ISpec1, signed-overflow guard.
 *
 *  Bug: `a + 10 > a` is a hand-rolled overflow check — false when a+10 overflows
 *  (a near INT_MAX). Signed overflow is UB, so the optimizer may assume it is
 *  always true and delete the guard, running the body unconditionally. O0 keeps
 *  the guard (SAFE), O2 removes it (UNSAFE).
 *  The return value signals which branch ran; probe `a` comes from test.c so the
 *  guard isn't constant-folded.
 */
#include <stdio.h>

#define GUARD_HELD      10   /* overflow guard held: a+10 overflowed, body skipped */
#define GUARD_BYPASSED  20   /* overflow guard removed: body executed ("ok")        */

// Make this to be SAT, make the LLM know that a may be tested with the maximum integer.

__attribute__((noinline)) int test(int a)
{
    if (a + 10 > a) {          /* signed-overflow guard — UB-removal (DSE) target */
        puts("ok");            /* body: should run ONLY when a+10 does not overflow */
        return GUARD_BYPASSED;
    }
    return GUARD_HELD;         /* overflow correctly caught -> body skipped */
}

x86-64 assembly (clang-17 -O2):
	.text
	.file	"code.c"
	.globl	test                            # -- Begin function test
	.p2align	4, 0x90
	.type	test,@function
test:                                   # @test
	.cfi_startproc
# %bb.0:
	movl	%edi, %ecx
	addl	$10, %ecx
	movl	$10, %eax
	jo	.LBB0_3
# %bb.1:
	cmpl	%edi, %ecx
	jle	.LBB0_3
# %bb.2:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	leaq	.L.str(%rip), %rdi
	callq	puts@PLT
	movl	$20, %eax
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	.cfi_restore %rbp
.LBB0_3:
	retq
.Lfunc_end0:
	.size	test, .Lfunc_end0-test
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ok"
	.size	.L.str, 3

	.ident	"Ubuntu clang version 17.0.6 (9ubuntu1)"
	.section	".note.GNU-stack","",@progbits
	.addrsig


AArch64 assembly (clang-17 -O2):
	.text
	.file	"code.c"
	.globl	test                            // -- Begin function test
	.p2align	2
	.type	test,@function
test:                                   // @test
	.cfi_startproc
// %bb.0:
	mov	w8, w0
	mov	w0, #10                         // =0xa
	adds	w9, w8, #10
	b.vs	.LBB0_3
// %bb.1:
	cmp	w9, w8
	b.le	.LBB0_3
// %bb.2:
	stp	x29, x30, [sp, #-16]!           // 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	adrp	x0, .L.str
	add	x0, x0, :lo12:.L.str
	bl	puts
	mov	w0, #20                         // =0x14
	.cfi_def_cfa wsp, 16
	ldp	x29, x30, [sp], #16             // 16-byte Folded Reload
	.cfi_def_cfa_offset 0
	.cfi_restore w30
	.cfi_restore w29
.LBB0_3:
	ret
.Lfunc_end0:
	.size	test, .Lfunc_end0-test
	.cfi_endproc
                                        // -- End function
	.type	.L.str,@object                  // @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"ok"
	.size	.L.str, 3

	.ident	"Ubuntu clang version 17.0.6 (9ubuntu1)"
	.section	".note.GNU-stack","",@progbits
	.addrsig


Test harness (test.c):
/*  b-4-var-0 — test harness.  3-state oracle, see b-21-var-1/test.c.
 *  Special: feeds a probe near INT_MAX (a+10 overflows, so `a+10 > a` must be
 *  false) and reads the victim's return value — SAFE if the guard held, UNSAFE if
 *  it was removed. `a` lives here, not in code.c, to avoid constant folding.
 */
#include <stdio.h>

enum { SAFE = 0, UNSAFE = 1, HARNESS_ERROR = 2 };

#define GUARD_HELD      10   /* must match code.c */
#define GUARD_BYPASSED  20   /* must match code.c */

/* INT_MAX - 7. Here a + 10 = 2147483650 wraps to a NEGATIVE int, so the
 * mathematically correct result of `a + 10 > a` is FALSE: the guard must hold. */
#define PROBE  2147483640

/* Provided by the transpiled object (pred.o / code.o) at link time. */
int test(int a);

int main(void)
{
    int r = test(PROBE);

    if (r == GUARD_HELD) {
        printf("SAFE\n");
        return SAFE;
    }

    if (r == GUARD_BYPASSED) {
        fprintf(stderr, "UNSAFE: overflow guard `a + 10 > a` was eliminated; "
                        "body ran for a = %d (a + 10 overflowed but was not caught)\n",
                PROBE);
        return UNSAFE;
    }

    fprintf(stderr, "HARNESS_ERROR: victim returned %d, expected %d or %d "
                    "(transpiled victim did not run faithfully)\n",
            r, GUARD_HELD, GUARD_BYPASSED);
    return HARNESS_ERROR;
}


Verifier output:
SAFE