#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*/ __VERIFIER_assert(int);
scalar_t__ __VERIFIER_nondet_bool();
int __VERIFIER_nondet_int();
int main() {
  int i = __VERIFIER_nondet_int();
  int k = __VERIFIER_nondet_int();
  int c = i + 2 * k;
  while (__VERIFIER_nondet_bool()) {
    int diff = __VERIFIER_nondet_int();
    i += 2 * diff;
    k += diff;
    c += 4 * diff;
  }
  __VERIFIER_assert(i + 2 * k == c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_bool@plt>
cmp    $0x0,%rax
je     11a2 <main+0x72>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1161 <main+0x31>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
lea    (%r14,%rbx,2),%r15d
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
je     1183 <main+0x53>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
lea    (%r14,%rax,2),%r14d
add    %eax,%ebx
lea    (%r15,%rax,4),%r15d
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_bool@plt>
test   %rax,%rax
jne    1160 <main+0x30>
lea    (%r14,%rbx,2),%eax
jmp    1186 <main+0x56>
mov    %r15d,%eax
xor    %edi,%edi
cmp    %r15d,%eax
sete   %dil
call   1050 <__VERIFIER_assert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %2
%7 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = mul nsw i32 2, %9
%11 = add nsw i32 %8, %10
store i32 %11, i32* %4
br label %12
12: ; preds = %15, %0
%13 = call i64 (...) @__VERIFIER_nondet_bool()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = mul nsw i32 2, %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = add nsw i32 %22, %21
store i32 %23, i32* %3
%24 = load i32, i32* %5
%25 = mul nsw i32 4, %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, %25
store i32 %27, i32* %4
br label %12
28: ; preds = %12
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = mul nsw i32 2, %30
%32 = add nsw i32 %29, %31
%33 = load i32, i32* %4
%34 = icmp eq i32 %32, %33
%35 = zext i1 %34 to i32
%36 = call i32 @__VERIFIER_assert(i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = shl nsw i32 %2, 1
%4 = add nsw i32 %3, %1
%5 = tail call i64 (...) @__VERIFIER_nondet_bool()
%6 = icmp eq i64 %5, 0
br i1 %6, label %22, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ %1, %0 ]
%9 = phi i32 [ %16, %7 ], [ %4, %0 ]
%10 = phi i32 [ %14, %7 ], [ %2, %0 ]
%11 = tail call i32 (...) @__VERIFIER_nondet_int()
%12 = shl nsw i32 %11, 1
%13 = add nsw i32 %12, %8
%14 = add nsw i32 %11, %10
%15 = shl nsw i32 %11, 2
%16 = add nsw i32 %15, %9
%17 = tail call i64 (...) @__VERIFIER_nondet_bool()
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %7
%20 = shl nsw i32 %14, 1
%21 = add nsw i32 %13, %20
br label %22
22: ; preds = %19, %0
%23 = phi i32 [ %21, %19 ], [ %4, %0 ]
%24 = phi i32 [ %16, %19 ], [ %4, %0 ]
%25 = icmp eq i32 %23, %24
%26 = zext i1 %25 to i32
%27 = tail call i32 @__VERIFIER_assert(i32 %26)
ret i32 0
}