#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*/ __CRAB_assume(int);
int /*<<< orphan*/ __CRAB_intrinsic_add_tag(int *, int);
int /*<<< orphan*/ __CRAB_intrinsic_check_does_not_have_tag(int *, int);
int int_nd();
int /*<<< orphan*/ sea_dsa_set_modified(int *);
int /*<<< orphan*/ sea_dsa_set_read(int *);
int main(int argc, char **argv) {
  int x = 0;
  int y = 1;
  int i = 0;
  __CRAB_intrinsic_add_tag(&i, 1);
  sea_dsa_set_modified(&i);
  ;
  __CRAB_intrinsic_add_tag(&x, 2);
  sea_dsa_set_modified(&x);
  ;
  __CRAB_intrinsic_add_tag(&y, 3);
  sea_dsa_set_modified(&y);
  ;
  int n = int_nd();
  __CRAB_assume(n > 0);
  while (i < n) {
    x = x + y;
    y = y + 1;
    i = i + 1;
  }
  __CRAB_intrinsic_check_does_not_have_tag(&i, 2);
  sea_dsa_set_read(&i);
  ;
  __CRAB_intrinsic_check_does_not_have_tag(&i, 3);
  sea_dsa_set_read(&i);
  ;
  __CRAB_intrinsic_check_does_not_have_tag(&y, 1);
  sea_dsa_set_read(&y);
  ;
  __CRAB_intrinsic_check_does_not_have_tag(&x, 3);
  sea_dsa_set_read(&x);
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x1,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
lea    -0x14(%rbp),%rdi
mov    $0x2,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
lea    -0x14(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
lea    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
lea    -0x18(%rbp),%rdi
call   1030 <sea_dsa_set_modified@plt>
mov    $0x0,%al
call   1070 <int_nd@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <__CRAB_assume@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1217 <main+0xb7>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11eb <main+0x8b>
lea    -0x1c(%rbp),%rdi
mov    $0x2,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <sea_dsa_set_read@plt>
lea    -0x1c(%rbp),%rdi
mov    $0x3,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
lea    -0x1c(%rbp),%rdi
call   1040 <sea_dsa_set_read@plt>
lea    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
lea    -0x18(%rbp),%rdi
call   1040 <sea_dsa_set_read@plt>
lea    -0x14(%rbp),%rdi
mov    $0x3,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
lea    -0x14(%rbp),%rdi
call   1040 <sea_dsa_set_read@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
mov    %rbx,%rdi
call   1030 <sea_dsa_set_modified@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
mov    %rbx,%rdi
call   1030 <sea_dsa_set_modified@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <__CRAB_intrinsic_add_tag@plt>
mov    %rbx,%rdi
call   1030 <sea_dsa_set_modified@plt>
xor    %eax,%eax
call   1070 <int_nd@plt>
mov    %eax,%ebx
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1060 <__CRAB_assume@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
jge    1221 <main+0xc1>
mov    0x8(%rsp),%ecx
mov    %eax,%edx
not    %edx
add    %ebx,%edx
lea    0x1(%rcx),%esi
imul   %edx,%esi
mov    %ebx,%edi
sub    %eax,%edi
add    $0xfffffffe,%edi
imul   %rdx,%rdi
shr    %rdi
mov    %ebx,%edx
add    %ecx,%edx
add    0xc(%rsp),%ecx
add    %esi,%ecx
add    %edi,%ecx
sub    %eax,%edx
mov    %ecx,0xc(%rsp)
mov    %edx,0x8(%rsp)
mov    %ebx,0x4(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
mov    %rbx,%rdi
call   1040 <sea_dsa_set_read@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
mov    %rbx,%rdi
call   1040 <sea_dsa_set_read@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
mov    %rbx,%rdi
call   1040 <sea_dsa_set_read@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <__CRAB_intrinsic_check_does_not_have_tag@plt>
mov    %rbx,%rdi
call   1040 <sea_dsa_set_read@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %7
store i32 0, i32* %8
%10 = call i32 @__CRAB_intrinsic_add_tag(i32* %8, i32 1)
%11 = call i32 @sea_dsa_set_modified(i32* %8)
%12 = call i32 @__CRAB_intrinsic_add_tag(i32* %6, i32 2)
%13 = call i32 @sea_dsa_set_modified(i32* %6)
%14 = call i32 @__CRAB_intrinsic_add_tag(i32* %7, i32 3)
%15 = call i32 @sea_dsa_set_modified(i32* %7)
%16 = call i32 (...) @int_nd()
store i32 %16, i32* %9
%17 = load i32, i32* %9
%18 = icmp sgt i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @__CRAB_assume(i32 %19)
br label %21
21: ; preds = %25, %2
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %33
25: ; preds = %21
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = add nsw i32 %26, %27
store i32 %28, i32* %6
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %21
33: ; preds = %21
%34 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %8, i32 2)
%35 = call i32 @sea_dsa_set_read(i32* %8)
%36 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %8, i32 3)
%37 = call i32 @sea_dsa_set_read(i32* %8)
%38 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %7, i32 1)
%39 = call i32 @sea_dsa_set_read(i32* %7)
%40 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %6, i32 3)
%41 = call i32 @sea_dsa_set_read(i32* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call i32 @__CRAB_intrinsic_add_tag(i32* %5, i32 1)
%10 = call i32 @sea_dsa_set_modified(i32* %5)
%11 = call i32 @__CRAB_intrinsic_add_tag(i32* %3, i32 2)
%12 = call i32 @sea_dsa_set_modified(i32* %3)
%13 = call i32 @__CRAB_intrinsic_add_tag(i32* %4, i32 3)
%14 = call i32 @sea_dsa_set_modified(i32* %4)
%15 = call i32 (...) @int_nd()
%16 = icmp sgt i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @__CRAB_assume(i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %15
br i1 %21, label %22, label %40
22: ; preds = %2
%23 = load i32, i32* %3
%24 = xor i32 %19, -1
%25 = add i32 %15, %24
%26 = add i32 %20, 1
%27 = mul i32 %25, %26
%28 = zext i32 %25 to i33
%29 = add i32 %15, -2
%30 = sub i32 %29, %19
%31 = zext i32 %30 to i33
%32 = mul i33 %28, %31
%33 = lshr i33 %32, 1
%34 = trunc i33 %33 to i32
%35 = add i32 %15, %20
%36 = add i32 %23, %20
%37 = add i32 %36, %27
%38 = add i32 %37, %34
%39 = sub i32 %35, %19
store i32 %38, i32* %3
store i32 %39, i32* %4
store i32 %15, i32* %5
br label %40
40: ; preds = %22, %2
%41 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %5, i32 2)
%42 = call i32 @sea_dsa_set_read(i32* %5)
%43 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %5, i32 3)
%44 = call i32 @sea_dsa_set_read(i32* %5)
%45 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %4, i32 1)
%46 = call i32 @sea_dsa_set_read(i32* %4)
%47 = call i32 @__CRAB_intrinsic_check_does_not_have_tag(i32* %3, i32 3)
%48 = call i32 @sea_dsa_set_read(i32* %3)
ret i32 0
}