#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 */
char *get_arg(int, char **, char *);
scalar_t__ get_flag(int, char **, char *);
int resume(char const *, unsigned long long);
unsigned long long strtoull(char const *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/);
int do_resume(int argc, char *argv[]) {
  const char *resume_file = "";
  const char *resume_arg;
  unsigned long long resume_offset;
  resume_arg = get_arg(argc, argv, "resume=");
  resume_file = resume_arg ? resume_arg : resume_file;
  if (!resume_file[0])
    return 0;
  resume_arg = get_arg(argc, argv, "resume_offset=");
  resume_offset = resume_arg ? strtoull(resume_arg, NULL, 0) : 0ULL;
  if (get_flag(argc, argv, "noresume"))
    return 0;
  return resume(resume_file, resume_offset);
}


x86 assembly (clang, -O0):
<do_resume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdx
call   1040 <get_arg@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1189 <do_resume+0x49>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1191 <do_resume+0x51>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11b2 <do_resume+0x72>
movl   $0x0,-0x4(%rbp)
jmp    1238 <do_resume+0xf8>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe48(%rip),%rdx
call   1040 <get_arg@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ec <do_resume+0xac>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %rax,-0x38(%rbp)
jmp    11f7 <do_resume+0xb7>
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
jmp    11f7 <do_resume+0xb7>
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe0a(%rip),%rdx
call   1030 <get_flag@plt>
cmp    $0x0,%rax
je     1228 <do_resume+0xe8>
movl   $0x0,-0x4(%rbp)
jmp    1238 <do_resume+0xf8>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <resume@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_resume>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xead(%rip),%rdx
call   1040 <get_arg@plt>
test   %rax,%rax
lea    0xea5(%rip),%rbx
cmovne %rax,%rbx
cmpb   $0x0,(%rbx)
je     11ab <do_resume+0x6b>
lea    0xe96(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <get_arg@plt>
test   %rax,%rax
je     1192 <do_resume+0x52>
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %rax,%r15
jmp    1195 <do_resume+0x55>
xor    %r15d,%r15d
lea    0xe7b(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <get_flag@plt>
test   %rax,%rax
je     11b8 <do_resume+0x78>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <resume@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"resume=\00"
@.str.2 = [15 x i8] c"resume_offset=\00"
@.str.3 = [9 x i8] c"noresume\00"
define i32 @do_resume(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i8* @get_arg(i32 %9, i8** %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i8*, i8** %7
br label %18
16: ; preds = %2
%17 = load i8*, i8** %6
br label %18
18: ; preds = %16, %14
%19 = phi i8* [ %15, %14 ], [ %17, %16 ]
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %18
store i32 0, i32* %3
br label %46
25: ; preds = %18
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i8* @get_arg(i32 %26, i8** %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i8* %28, i8** %7
%29 = load i8*, i8** %7
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i8*, i8** %7
%33 = call i64 @strtoull(i8* %32, i32* null, i32 0)
br label %35
34: ; preds = %25
br label %35
35: ; preds = %34, %31
%36 = phi i64 [ %33, %31 ], [ 0, %34 ]
store i64 %36, i64* %8
%37 = load i32, i32* %4
%38 = load i8**, i8*** %5
%39 = call i64 @get_flag(i32 %37, i8** %38, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %35
store i32 0, i32* %3
br label %46
42: ; preds = %35
%43 = load i8*, i8** %6
%44 = load i64, i64* %8
%45 = call i32 @resume(i8* %43, i64 %44)
store i32 %45, i32* %3
br label %46
46: ; preds = %42, %41, %24
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"resume=\00"
@.str.2 = [15 x i8] c"resume_offset=\00"
@.str.3 = [9 x i8] c"noresume\00"
define i32 @do_resume(i32 %0, i8** %1) {
%3 = tail call i8* @get_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %2
%9 = tail call i8* @get_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i64 @strtoull(i8* nocapture %9, i32* null, i32 0)
br label %13
13: ; preds = %8, %11
%14 = phi i64 [ %12, %11 ], [ 0, %8 ]
%15 = tail call i64 @get_flag(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @resume(i8* %5, i64 %14)
br label %19
19: ; preds = %13, %2, %17
%20 = phi i32 [ %18, %17 ], [ 0, %2 ], [ 0, %13 ]
ret i32 %20
}