#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 rand();
int /*<<< orphan*/ tmpl(char *);
void main() {
  int n, v;
  int i = 0;
  int k = 0;
  while (i < n) {
    tmpl("(le(v,i,j,k,n),le(v,i,j,k,n))");
    i++;
    v = rand();
    if (v > 0)
      k = k + v;
    else
      k++;
  }
  int j = 0;
  while (j < n) {
    tmpl("(le(v,i,j,k,n),le(v,i,j,k,n))");
    if (k <= 0)
    ERROR:;
      j++;
    k--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1187 <main+0x67>
lea    0xeb7(%rip),%rdi
call   1030 <tmpl@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1179 <main+0x59>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <main+0x62>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d1 <main+0xb1>
lea    0xe5f(%rip),%rdi
call   1030 <tmpl@plt>
cmpl   $0x0,-0x10(%rbp)
jg     11ba <main+0x9a>
jmp    11b5 <main+0x95>
jmp    11ba <main+0x9a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    118e <main+0x6e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
ret

LLVM IR (-O0):
@.str = [30 x i8] c"(le(v,i,j,k,n),le(v,i,j,k,n))\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %1
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = call i32 @tmpl(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = call i32 (...) @rand()
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = add nsw i32 %18, %19
store i32 %20, i32* %4
br label %24
21: ; preds = %10
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %21, %17
br label %6
25: ; preds = %6
store i32 0, i32* %5
br label %26
26: ; preds = %36, %25
%27 = load i32, i32* %5
%28 = load i32, i32* %1
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = call i32 @tmpl(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %4
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35, %30
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
%39 = load i32, i32* %4
%40 = add nsw i32 %39, -1
store i32 %40, i32* %4
br label %26
41: ; preds = %26
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}