#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 is_u1(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int find_u1(char *_out_path, char *_prefix, int _from, int _to) {
  int i;
  for (i = _from; i <= _to; i++) {
    sprintf(_out_path, "%s%d", _prefix, i);
    if (is_u1(_out_path) == 1) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<find_u1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1190 <find_u1+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <is_u1@plt>
cmp    $0x1,%eax
jne    117d <find_u1+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    1197 <find_u1+0x77>
jmp    1182 <find_u1+0x62>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113c <find_u1+0x1c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_u1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
cmp    %ecx,%edx
jg     117d <find_u1+0x5d>
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%rbp
add    $0x1,%r12d
lea    0xeb8(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1040 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <is_u1@plt>
cmp    $0x1,%eax
je     1177 <find_u1+0x57>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1150 <find_u1+0x30>
jmp    117d <find_u1+0x5d>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s%d\00"
define i32 @find_u1(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, %3
br i1 %5, label %14, label %9
6: ; preds = %9
%7 = add i32 %10, 1
%8 = icmp eq i32 %10, %3
br i1 %8, label %14, label %9
9: ; preds = %4, %6
%10 = phi i32 [ %7, %6 ], [ %2, %4 ]
%11 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %10)
%12 = tail call i32 @is_u1(i8* %0)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %6
14: ; preds = %9, %6, %4
%15 = phi i32 [ 0, %4 ], [ 0, %6 ], [ 1, %9 ]
ret i32 %15
}