#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*/ are_you_sure();
int /*<<< orphan*/ printf(char *, char *);
int restore_all_records__probe(char *, int);
int restore_all_records(char *device_name) {
  int result;
  result = restore_all_records__probe(device_name, (!(0)));
  if (result == ((0))) {
    printf("%s"
           "\n",
           "backup consistency check failed");
    return ((0));
  };
  if (are_you_sure() == (0))
    return ((0));
  result = restore_all_records__probe(device_name, (0));
  if (result == ((0))) {
    ;
    return ((0));
  };
  printf("%s"
         "\n",
         "backup sequence restored");
  return ((!(0)));
}


x86 assembly (clang, -O0):
<restore_all_records>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <restore_all_records__probe@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1176 <restore_all_records+0x46>
lea    0xea2(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <restore_all_records+0xa0>
mov    $0x0,%al
call   1050 <are_you_sure@plt>
cmp    $0x0,%eax
jne    1192 <restore_all_records+0x62>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <restore_all_records+0xa0>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <restore_all_records__probe@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11b6 <restore_all_records+0x86>
movl   $0x0,-0x4(%rbp)
jmp    11d0 <restore_all_records+0xa0>
lea    0xe43(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_all_records>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%esi
call   1030 <restore_all_records__probe@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     116f <restore_all_records+0x3f>
xor    %eax,%eax
call   1050 <are_you_sure@plt>
test   %eax,%eax
je     1182 <restore_all_records+0x52>
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <restore_all_records__probe@plt>
test   %eax,%eax
je     1182 <restore_all_records+0x52>
mov    $0x1,%ebp
lea    0xeb7(%rip),%rsi
jmp    1176 <restore_all_records+0x46>
lea    0xe8e(%rip),%rsi
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [32 x i8] c"backup consistency check failed\00"
@.str.2 = [25 x i8] c"backup sequence restored\00"
define i32 @restore_all_records(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @restore_all_records__probe(i8* %5, i32 1)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %23
11: ; preds = %1
%12 = call i32 (...) @are_you_sure()
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %2
br label %23
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 @restore_all_records__probe(i8* %16, i32 0)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %2
br label %23
21: ; preds = %15
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %23
23: ; preds = %21, %20, %14, %9
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [32 x i8] c"backup consistency check failed\00"
@.str.2 = [25 x i8] c"backup sequence restored\00"
define i32 @restore_all_records(i8* %0) {
%2 = tail call i32 @restore_all_records__probe(i8* %0, i32 1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i32 (...) @are_you_sure()
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32 @restore_all_records__probe(i8* %0, i32 0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7, %1
%11 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %7 ]
%12 = phi i32 [ 0, %1 ], [ 1, %7 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %14
14: ; preds = %10, %7, %4
%15 = phi i32 [ 0, %4 ], [ 0, %7 ], [ %12, %10 ]
ret i32 %15
}