#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*/ printf(char *, int);
int scanf(char *, int *);
int main(void) {
  int x, z, soma = 0, i;
  scanf("%d", &x);
  while (scanf("%d", &z), z <= x)
    ;
  for (i = 0; soma <= z; i++) {
    soma += x++;
  }
  printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1167 <main+0x47>
jmp    1146 <main+0x26>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1199 <main+0x79>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <main+0x4e>
mov    -0x14(%rbp),%esi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%eax
cmp    %eax,%ecx
jle    1140 <main+0x20>
xor    %esi,%esi
test   %ecx,%ecx
js     1170 <main+0x50>
xor    %edx,%edx
xchg   %ax,%ax
add    %eax,%edx
add    %esi,%edx
add    $0x1,%esi
cmp    %ecx,%edx
jle    1160 <main+0x40>
add    %esi,%eax
mov    %eax,(%rsp)
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %6
6: ; preds = %6, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = icmp slt i32 %8, 0
br i1 %12, label %22, label %13
13: ; preds = %11, %13
%14 = phi i32 [ %19, %13 ], [ 0, %11 ]
%15 = phi i32 [ %18, %13 ], [ 0, %11 ]
%16 = phi i32 [ %17, %13 ], [ %9, %11 ]
%17 = add nsw i32 %16, 1
%18 = add nsw i32 %16, %15
%19 = add nuw nsw i32 %14, 1
%20 = icmp sgt i32 %18, %8
br i1 %20, label %21, label %13
21: ; preds = %13
store i32 %17, i32* %1
br label %22
22: ; preds = %21, %11
%23 = phi i32 [ %19, %21 ], [ 0, %11 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
ret i32 0
}