#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*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ start_instrument();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stop_instrument();
int main(int argc) {
  int i, x, y;
  start_instrument();
  x = argc;
  y = 0;
  i = 0;
  do {
    if (x % 2) {
      y++;
    }
    i++;
    x++;
  } while (i < 10);
  stop_instrument();
  fprintf(stderr, "y=%d\n", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <start_instrument@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     117a <main+0x4a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jl     115d <main+0x2d>
mov    $0x0,%al
call   1040 <stop_instrument@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe50(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <start_instrument@plt>
movd   %ebx,%xmm0
and    $0x1,%ebx
mov    $0x1,%eax
movd   %eax,%xmm1
pand   %xmm0,%xmm1
paddd  %xmm1,%xmm1
paddd  %xmm1,%xmm1
movd   %xmm1,%ebp
add    %ebx,%ebp
xor    $0x1,%ebx
add    %ebx,%ebp
add    %ebx,%ebp
add    %ebx,%ebp
add    %ebx,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1040 <stop_instrument@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
mov    %ebp,%edx
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"y=%d\0A\00"
define i32 @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %2
store i32 %0, i32* %3
%7 = call i32 (...) @start_instrument()
%8 = load i32, i32* %3
store i32 %8, i32* %5
store i32 0, i32* %6
store i32 0, i32* %4
br label %9
9: ; preds = %21, %1
%10 = load i32, i32* %5
%11 = srem i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %21
21: ; preds = %16
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 10
br i1 %23, label %9, label %24
24: ; preds = %21
%25 = call i32 (...) @stop_instrument()
%26 = load i32, i32* @stderr
%27 = load i32, i32* %6
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"y=%d\0A\00"
define i32 @main(i32 %0) {
%2 = tail call i32 (...) @start_instrument()
%3 = and i32 %0, 1
%4 = xor i32 %3, 1
%5 = insertelement <4 x i32> poison, i32 %0, i64 0
%6 = and <4 x i32> %5, <i32 1, i32 poison, i32 poison, i32 poison>
%7 = shufflevector <4 x i32> %6, <4 x i32> poison, <4 x i32> zeroinitializer
%8 = and i32 %0, 1
%9 = xor i32 %8, 1
%10 = and i32 %0, 1
%11 = xor i32 %10, 1
%12 = and i32 %0, 1
%13 = xor i32 %12, 1
%14 = and i32 %0, 1
%15 = and i32 %0, 1
%16 = xor i32 %15, 1
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %7)
%18 = add nuw nsw i32 %17, %14
%19 = add nuw nsw i32 %18, %4
%20 = add nuw nsw i32 %19, %9
%21 = add nuw nsw i32 %20, %11
%22 = add nuw nsw i32 %21, %13
%23 = add nuw nsw i32 %22, %16
%24 = tail call i32 (...) @stop_instrument()
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}