#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ copy(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ *optarg;
int /*<<< orphan*/ printf(char const *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  const char *usage =
      "\n"
      "NAME\n"
      "  autoconf - Detect architecture model for MSR definitions\n"
      "SYNOPSIS\n"
      "  %s [--help | -h] [-f]\n"
      "OVERVIEW\n"
      "  Autoconf was built to determine the architecture model for\n"
      "  which libmsr is being built on. The architecture determines\n"
      "  the offsets for several MSRs, which may be architecture-specific.\n"
      "OPTIONS\n"
      "  --help | -h\n"
      "      Display this help information, then exit.\n"
      "  -f\n"
      "      Target architecture model.\n"
      "\n";
  if (argc > 1 && (strncmp(argv[1], "--help", strlen("--help")) == 0 ||
                   strncmp(argv[1], "-h", strlen("-h")) == 0)) {
    printf(usage, argv[0]);
    return EXIT_SUCCESS;
  }
  if (argc > 3) {
    printf(usage, argv[0]);
    return EXIT_FAILURE;
  }
  if (argc == 1) {
    copy(NULL);
    return EXIT_SUCCESS;
  }
  int opt;
  while ((opt = getopt(argc, argv, "f:")) != -1) {
    switch (opt) {
    case 'f':
      copy(optarg);
      break;
    default:
      fprintf(stderr, "\nError: unknown parameter \"%c\"\n", opt);
      fprintf(stderr, usage, argv[0]);
      return EXIT_FAILURE;
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1214 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
lea    0xffa(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xfe8(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11f3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
lea    0xfcd(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xfbb(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1214 <main+0xb4>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <printf@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1303 <main+0x1a3>
cmpl   $0x3,-0x8(%rbp)
jle    123f <main+0xdf>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1050 <printf@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1303 <main+0x1a3>
cmpl   $0x1,-0x8(%rbp)
jne    1263 <main+0x103>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <copy@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1303 <main+0x1a3>
jmp    1268 <main+0x108>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf2c(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     12f7 <main+0x197>
mov    -0x1c(%rbp),%eax
sub    $0x66,%eax
jne    12ac <main+0x14c>
jmp    1298 <main+0x138>
mov    0x2d59(%rip),%rax
mov    (%rax),%rdi
call   1060 <copy@plt>
jmp    12f2 <main+0x192>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2ce8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1303 <main+0x1a3>
jmp    1268 <main+0x108>
mov    0x2cca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x2,%edi
jl     11d8 <main+0x78>
mov    0x8(%rbx),%r14
lea    0x101c(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1223 <main+0xc3>
mov    0x8(%rbx),%r14
lea    0xffa(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1223 <main+0xc3>
cmp    $0x4,%ebp
jb     11ff <main+0x9f>
mov    (%rbx),%rsi
lea    0xe32(%rip),%rdi
call   1050 <printf@plt>
jmp    1269 <main+0x109>
cmp    $0x1,%ebp
jne    11ff <main+0x9f>
xor    %edi,%edi
call   1060 <copy@plt>
jmp    121a <main+0xba>
cs nopw 0x0(%rax,%rax,1)
mov    0x2e01(%rip),%rax
mov    (%rax),%rdi
call   1060 <copy@plt>
lea    0xf9c(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <getopt@plt>
cmp    $0x66,%eax
je     11f0 <main+0x90>
cmp    $0xffffffff,%eax
jne    123b <main+0xdb>
mov    0x2da7(%rip),%rax
jmp    1270 <main+0x110>
mov    (%rbx),%rsi
lea    0xdd3(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d8f(%rip),%rax
jmp    1270 <main+0x110>
mov    0x2d96(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xf59(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xd9e(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [408 x i8] c"\0ANAME\0A autoconf - Detect architecture model for MSR definitions\0ASYNOPSIS\0A %s [--help | -h] [-f]\0AOVERVIEW\0A Autoconf was built to determine the architecture model for\0A which libmsr is being built on. The architecture determines\0A the offsets for several MSRs, which may be architecture-specific.\0AOPTIONS\0A --help | -h\0A Display this help information, then exit.\0A -f\0A Target architecture model.\0A\0A\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-h\00"
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"f:\00"
@optarg = global i32* null
@stderr = global i32 0
@.str.4 = [32 x i8] c"\0AError: unknown parameter \22%c\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([408 x i8], [408 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %31
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = call i64 @strncmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %17, %10
%25 = load i8*, i8** %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* %25, i8* %28)
%30 = load i32, i32* @EXIT_SUCCESS
store i32 %30, i32* %3
br label %72
31: ; preds = %17, %2
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 3
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = load i8*, i8** %6
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @printf(i8* %35, i8* %38)
%40 = load i32, i32* @EXIT_FAILURE
store i32 %40, i32* %3
br label %72
41: ; preds = %31
%42 = load i32, i32* %4
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = call i32 @copy(i32* null)
%46 = load i32, i32* @EXIT_SUCCESS
store i32 %46, i32* %3
br label %72
47: ; preds = %41
br label %48
48: ; preds = %69, %47
%49 = load i32, i32* %4
%50 = load i8**, i8*** %5
%51 = call i32 @getopt(i32 %49, i8** %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 %51, i32* %7
%52 = icmp ne i32 %51, -1
br i1 %52, label %53, label %70
53: ; preds = %48
%54 = load i32, i32* %7
switch i32 %54, label %58 [
i32 102, label %55
]
55: ; preds = %53
%56 = load i32*, i32** @optarg
%57 = call i32 @copy(i32* %56)
br label %69
58: ; preds = %53
%59 = load i32, i32* @stderr
%60 = load i32, i32* %7
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %60)
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %6
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 0
%66 = load i8*, i8** %65
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* %63, i8* %66)
%68 = load i32, i32* @EXIT_FAILURE
store i32 %68, i32* %3
br label %72
69: ; preds = %55
br label %48
70: ; preds = %48
%71 = load i32, i32* @EXIT_SUCCESS
store i32 %71, i32* %3
br label %72
72: ; preds = %70, %58, %44, %34, %24
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [408 x i8] c"\0ANAME\0A autoconf - Detect architecture model for MSR definitions\0ASYNOPSIS\0A %s [--help | -h] [-f]\0AOVERVIEW\0A Autoconf was built to determine the architecture model for\0A which libmsr is being built on. The architecture determines\0A the offsets for several MSRs, which may be architecture-specific.\0AOPTIONS\0A --help | -h\0A Display this help information, then exit.\0A -f\0A Target architecture model.\0A\0A\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-h\00"
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"f:\00"
@optarg = global i32* null
@stderr = global i32 0
@.str.4 = [32 x i8] c"\0AError: unknown parameter \22%c\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = load i8*, i8** %5
%12 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10, %4
%16 = load i8*, i8** %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([408 x i8], [408 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %39
18: ; preds = %10
%19 = icmp ugt i32 %0, 3
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = load i8*, i8** %1
%22 = tail call i32 @printf(i8* getelementptr inbounds ([408 x i8], [408 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %39
23: ; preds = %2
%24 = icmp eq i32 %0, 1
br i1 %24, label %26, label %25
25: ; preds = %18, %23
br label %28
26: ; preds = %23
%27 = tail call i32 @copy(i32* null)
br label %39
28: ; preds = %25, %30
%29 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
switch i32 %29, label %33 [
i32 -1, label %39
i32 102, label %30
]
30: ; preds = %28
%31 = load i32*, i32** @optarg
%32 = tail call i32 @copy(i32* %31)
br label %28
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %1
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([408 x i8], [408 x i8]* @.str, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %28, %33, %26, %20, %15
%40 = phi i32* [ @EXIT_SUCCESS, %15 ], [ @EXIT_FAILURE, %20 ], [ @EXIT_SUCCESS, %26 ], [ @EXIT_FAILURE, %33 ], [ @EXIT_SUCCESS, %28 ]
%41 = load i32, i32* %40
ret i32 %41
}