#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strncmp(char *, char *, int);
void parse_args(int argc, char **argv, char **prefix, char **source_file_name) {
  if (argc < 3) {
    fprintf(stderr, "Usage: mkmsgcat -<prefix> <source_file_name>\n");
    exit(1);
  }
  argv++;
  argc--;
  if (strncmp(*argv, "-", 1)) {
    fprintf(stderr, "Usage: mkmsgcat -<prefix> <source_file_name>\n");
    exit(1);
  } else {
    (*argv)++;
    *prefix = *argv;
    argv++;
    argc--;
    *source_file_name = *argv;
  }
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    1170 <parse_args+0x40>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11c6 <parse_args+0x96>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jle    1179 <parse_args+0x49>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xee0(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1179 <parse_args+0x49>
mov    0x8(%rbx),%rax
add    $0x1,%rax
mov    %rax,0x8(%rbx)
mov    %rax,(%r15)
mov    0x10(%rbx),%rax
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: mkmsgcat -<prefix> <source_file_name>\0A\00"
@.str.1 = [2 x i8] c"-\00"
define void @parse_args(i32 %0, i8** %1, i8** %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8**
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %4
%16 = load i8**, i8*** %6
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %6
%18 = load i32, i32* %5
%19 = add nsw i32 %18, -1
store i32 %19, i32* %5
%20 = load i8**, i8*** %6
%21 = load i8*, i8** %20
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %15
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %15
%29 = load i8**, i8*** %6
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %29
%32 = load i8**, i8*** %6
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %7
store i8* %33, i8** %34
%35 = load i8**, i8*** %6
%36 = getelementptr inbounds i8*, i8** %35, i32 1
store i8** %36, i8*** %6
%37 = load i32, i32* %5
%38 = add nsw i32 %37, -1
store i32 %38, i32* %5
%39 = load i8**, i8*** %6
%40 = load i8*, i8** %39
%41 = load i8**, i8*** %8
store i8* %40, i8** %41
br label %42
42: ; preds = %28
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"Usage: mkmsgcat -<prefix> <source_file_name>\0A\00"
@.str.1 = [2 x i8] c"-\00"
define void @parse_args(i32 %0, i8** nocapture %1, i8** nocapture writeonly %2, i8** nocapture writeonly %3) {
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strncmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %10
%20 = load i8*, i8** %11
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %21, i8** %11
store i8* %21, i8** %2
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
store i8* %23, i8** %3
ret void
}