#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*/ EBADE;
int /*<<< orphan*/ EBADRQC;
scalar_t__ check_resp(int, int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/);
int criu_dump();
int /*<<< orphan*/ criu_set_log_file(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ get_base_req();
int /*<<< orphan*/ printf(char *);
int bad_options(void) {
  int ret;
  printf("--- Try to send criu invalid opts\n");
  get_base_req();
  criu_set_log_file("../file.log");
  ret = criu_dump();
  if (check_resp(ret, -EBADE, errno, EBADRQC))
    goto err;
  printf("   `- Success\n");
  return 0;
err:
  return -1;
}


x86 assembly (clang, -O0):
<bad_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <get_base_req@plt>
lea    0xeb1(%rip),%rdi
call   1070 <criu_set_log_file@plt>
mov    $0x0,%al
call   1050 <criu_dump@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
mov    0x2e53(%rip),%rax
sub    (%rax),%esi
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
mov    0x2e51(%rip),%rax
mov    (%rax),%ecx
call   1040 <check_resp@plt>
cmp    $0x0,%rax
je     11b5 <bad_options+0x65>
jmp    11cd <bad_options+0x7d>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <bad_options+0x84>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad_options>:
push   %rbx
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <get_base_req@plt>
lea    0xe93(%rip),%rdi
call   1070 <criu_set_log_file@plt>
xor    %eax,%eax
call   1050 <criu_dump@plt>
mov    0x2e60(%rip),%rcx
sub    (%rcx),%ebx
mov    0x2e47(%rip),%rcx
mov    (%rcx),%edx
mov    0x2e5e(%rip),%rcx
mov    (%rcx),%ecx
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <check_resp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     11ac <bad_options+0x5c>
pop    %rbx
ret
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"--- Try to send criu invalid opts\0A\00"
@.str.1 = [12 x i8] c"../file.log\00"
@EBADE = global i32 0
@errno = global i32 0
@EBADRQC = global i32 0
@.str.2 = [15 x i8] c" `- Success\0A\00"
define i32 @bad_options() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @get_base_req()
%5 = call i32 @criu_set_log_file(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @criu_dump()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* @EBADE
%9 = sub nsw i32 0, %8
%10 = load i32, i32* @errno
%11 = load i32, i32* @EBADRQC
%12 = call i64 @check_resp(i32 %7, i32 %9, i32 %10, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %0
br label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %18
17: ; preds = %14
store i32 -1, i32* %1
br label %18
18: ; preds = %17, %15
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"../file.log\00"
@EBADE = global i32 0
@errno = global i32 0
@EBADRQC = global i32 0
@str = [34 x i8] c"--- Try to send criu invalid opts\00"
@str.3 = [14 x i8] c" `- Success\00"
define i32 @bad_options() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @get_base_req()
%3 = tail call i32 @criu_set_log_file(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @criu_dump()
%5 = load i32, i32* @EBADE
%6 = sub nsw i32 0, %5
%7 = load i32, i32* @errno
%8 = load i32, i32* @EBADRQC
%9 = tail call i64 @check_resp(i32 %4, i32 %6, i32 %7, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.3, i64 0, i64 0))
br label %13
13: ; preds = %0, %11
%14 = phi i32 [ 0, %11 ], [ -1, %0 ]
ret i32 %14
}