#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*/ atoi(char *);
int /*<<< orphan*/ format_data(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc == 4)
    format_data(argv[1], argv[2], atoi(argv[3]));
  else
    printf("Usage: DataExtract input_buffer_file_path pattern n_arg\n\r");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    1189 <main+0x59>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <format_data@plt>
jmp    1195 <main+0x65>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1159 <main+0x29>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    0x18(%rsi),%rdi
call   1050 <atoi@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <format_data@plt>
jmp    1165 <main+0x35>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Usage: DataExtract input_buffer_file_path pattern n_arg\0A\0D\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 4
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 3
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = call i32 @format_data(i8* %11, i8* %14, i32 %18)
br label %22
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"Usage: DataExtract input_buffer_file_path pattern n_arg\0A\0D\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i32 @format_data(i8* %6, i8* %8, i32 %11)
br label %15
13: ; preds = %2
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %4
ret i32 0
}