#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 atoi(char *);
int cert_key(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int url_key(char *, char *, char *);
int /*<<< orphan*/ usage(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int arg, err = 1;
  char *fpr = NULL, *url = NULL, *keyfile = NULL, *name = NULL;
  if (argc == 1) {
    usage(stderr);
    return 1;
  } else if (argc > 1 && strcmp(argv[1], "--version") == 0) {
    printf("make-dns-cert gnupg-svn%d\n", atoi(10 + "$Revision: 4728 $"));
    return 0;
  } else if (argc > 1 && strcmp(argv[1], "--help") == 0) {
    usage(stdout);
    return 0;
  }
  while ((arg = getopt(argc, argv, "hf:u:k:n:")) != -1)
    switch (arg) {
    default:
    case 'h':
      usage(stdout);
      exit(0);
    case 'f':
      fpr = optarg;
      break;
    case 'u':
      url = optarg;
      break;
    case 'k':
      keyfile = optarg;
      break;
    case 'n':
      name = optarg;
      break;
    }
  if (!name) {
    fprintf(stderr, "No name provided\n");
    return 1;
  }
  if (keyfile && (fpr || url)) {
    fprintf(stderr, "Cannot generate a CERT record with both a keyfile and"
                    " a fingerprint or URL\n");
    return 1;
  }
  if (keyfile)
    err = cert_key(name, keyfile);
  else
    err = url_key(name, fpr, url);
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11f1 <main+0x61>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    13ea <main+0x25a>
cmpl   $0x1,-0x8(%rbp)
jle    1243 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1243 <main+0xb3>
lea    0xe45(%rip),%rdi
add    $0xa,%rdi
call   10a0 <atoi@plt>
mov    %eax,%esi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13ea <main+0x25a>
cmpl   $0x1,-0x8(%rbp)
jle    1285 <main+0xf5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1285 <main+0xf5>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    13ea <main+0x25a>
jmp    128a <main+0xfa>
jmp    128f <main+0xff>
jmp    1294 <main+0x104>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xddc(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1342 <main+0x1b2>
mov    -0x14(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0xf,%eax
ja     12dc <main+0x14c>
mov    -0x40(%rbp),%rax
lea    0xd2d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    12e1 <main+0x151>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    133d <main+0x1ad>
mov    0x2ce8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    133d <main+0x1ad>
mov    0x2cd5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    133d <main+0x1ad>
mov    0x2cc2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1294 <main+0x104>
cmpq   $0x0,-0x38(%rbp)
jne    136e <main+0x1de>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
lea    0xd2b(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13ea <main+0x25a>
cmpq   $0x0,-0x30(%rbp)
je     13b0 <main+0x220>
cmpq   $0x0,-0x20(%rbp)
jne    138f <main+0x1ff>
cmpq   $0x0,-0x28(%rbp)
je     13b0 <main+0x220>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    0xcfb(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13ea <main+0x25a>
cmpq   $0x0,-0x30(%rbp)
je     13d0 <main+0x240>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <cert_key@plt>
mov    %eax,-0x18(%rbp)
jmp    13e4 <main+0x254>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <url_key@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jne    11bb <main+0x2b>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
mov    $0x1,%eax
jmp    1317 <main+0x187>
mov    %rsi,%r15
mov    %edi,%ebp
jle    11f4 <main+0x64>
mov    0x8(%r15),%rdi
lea    0xe33(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12b7 <main+0x127>
mov    0x8(%r15),%rdi
lea    0xe51(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1307 <main+0x177>
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe3c(%rip),%r14
mov    0x2def(%rip),%r13
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
jmp    1224 <main+0x94>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%rbx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1090 <getopt@plt>
cmp    $0x6e,%eax
je     1220 <main+0x90>
cmp    $0x6a,%eax
jg     124f <main+0xbf>
cmp    $0xffffffff,%eax
je     1273 <main+0xe3>
cmp    $0x66,%eax
jne    1326 <main+0x196>
mov    0x0(%r13),%r12
jmp    1224 <main+0x94>
cmp    $0x6b,%eax
je     1268 <main+0xd8>
cmp    $0x75,%eax
jne    1326 <main+0x196>
mov    0x0(%r13),%rax
mov    %rax,0x8(%rsp)
jmp    1224 <main+0x94>
mov    0x0(%r13),%rax
mov    %rax,0x10(%rsp)
jmp    1224 <main+0x94>
test   %rbx,%rbx
je     129b <main+0x10b>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     12d3 <main+0x143>
or     0x8(%rsp),%r12
je     12f1 <main+0x161>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
jmp    12ab <main+0x11b>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
lea    0xd9d(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    1317 <main+0x187>
lea    0xd71(%rip),%rdi
call   10a0 <atoi@plt>
lea    0xd40(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    1315 <main+0x185>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    0x8(%rsp),%rdx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <url_key@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <cert_key@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"--version\00"
@.str.1 = [27 x i8] c"make-dns-cert gnupg-svn%d\0A\00"
@.str.2 = [18 x i8] c"$Revision: 4728 $\00"
@.str.3 = [7 x i8] c"--help\00"
@stdout = global i32 0
@.str.4 = [10 x i8] c"hf:u:k:n:\00"
@optarg = global i8* null
@.str.5 = [18 x i8] c"No name provided\0A\00"
@.str.6 = [76 x i8] c"Cannot generate a CERT record with both a keyfile and a fingerprint or URL\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @usage(i32 %15)
store i32 1, i32* %3
br label %97
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = call i32 @atoi(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 10))
%28 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 0, i32* %3
br label %97
29: ; preds = %20, %17
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %32
%39 = load i32, i32* @stdout
%40 = call i32 @usage(i32 %39)
store i32 0, i32* %3
br label %97
41: ; preds = %32, %29
br label %42
42: ; preds = %41
br label %43
43: ; preds = %42
br label %44
44: ; preds = %64, %43
%45 = load i32, i32* %4
%46 = load i8**, i8*** %5
%47 = call i32 @getopt(i32 %45, i8** %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 %47, i32* %6
%48 = icmp ne i32 %47, -1
br i1 %48, label %49, label %65
49: ; preds = %44
%50 = load i32, i32* %6
switch i32 %50, label %51 [
i32 104, label %52
i32 102, label %56
i32 117, label %58
i32 107, label %60
i32 110, label %62
]
51: ; preds = %49
br label %52
52: ; preds = %49, %51
%53 = load i32, i32* @stdout
%54 = call i32 @usage(i32 %53)
%55 = call i32 @exit(i32 0)
unreachable
56: ; preds = %49
%57 = load i8*, i8** @optarg
store i8* %57, i8** %8
br label %64
58: ; preds = %49
%59 = load i8*, i8** @optarg
store i8* %59, i8** %9
br label %64
60: ; preds = %49
%61 = load i8*, i8** @optarg
store i8* %61, i8** %10
br label %64
62: ; preds = %49
%63 = load i8*, i8** @optarg
store i8* %63, i8** %11
br label %64
64: ; preds = %62, %60, %58, %56
br label %44
65: ; preds = %44
%66 = load i8*, i8** %11
%67 = icmp ne i8* %66, null
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %97
71: ; preds = %65
%72 = load i8*, i8** %10
%73 = icmp ne i8* %72, null
br i1 %73, label %74, label %83
74: ; preds = %71
%75 = load i8*, i8** %8
%76 = icmp ne i8* %75, null
br i1 %76, label %80, label %77
77: ; preds = %74
%78 = load i8*, i8** %9
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %83
80: ; preds = %77, %74
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %97
83: ; preds = %77, %71
%84 = load i8*, i8** %10
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = load i8*, i8** %11
%88 = load i8*, i8** %10
%89 = call i32 @cert_key(i8* %87, i8* %88)
store i32 %89, i32* %7
br label %95
90: ; preds = %83
%91 = load i8*, i8** %11
%92 = load i8*, i8** %8
%93 = load i8*, i8** %9
%94 = call i32 @url_key(i8* %91, i8* %92, i8* %93)
store i32 %94, i32* %7
br label %95
95: ; preds = %90, %86
%96 = load i32, i32* %7
store i32 %96, i32* %3
br label %97
97: ; preds = %95, %80, %68, %38, %26, %14
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"--version\00"
@.str.1 = [27 x i8] c"make-dns-cert gnupg-svn%d\0A\00"
@.str.2 = [18 x i8] c"$Revision: 4728 $\00"
@.str.3 = [7 x i8] c"--help\00"
@stdout = global i32 0
@.str.4 = [10 x i8] c"hf:u:k:n:\00"
@optarg = global i8* null
@.str.5 = [18 x i8] c"No name provided\0A\00"
@.str.6 = [76 x i8] c"Cannot generate a CERT record with both a keyfile and a fingerprint or URL\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @usage(i32 %5)
br label %70
7: ; preds = %2
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %21
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @atoi(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 10))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %70
17: ; preds = %9
%18 = load i8*, i8** %10
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %7, %17
br label %34
22: ; preds = %17
%23 = load i32, i32* @stdout
%24 = tail call i32 @usage(i32 %23)
br label %70
25: ; preds = %47, %50
%26 = phi i8* [ %51, %50 ], [ %49, %47 ]
%27 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
switch i32 %27, label %28 [
i32 -1, label %52
i32 110, label %50
i32 102, label %32
i32 117, label %39
i32 107, label %45
]
28: ; preds = %25
%29 = load i32, i32* @stdout
%30 = tail call i32 @usage(i32 %29)
%31 = tail call i32 @exit(i32 0)
unreachable
32: ; preds = %25
%33 = load i8*, i8** @optarg
br label %34
34: ; preds = %21, %32
%35 = phi i8* [ null, %21 ], [ %33, %32 ]
%36 = phi i8* [ null, %21 ], [ %42, %32 ]
%37 = phi i8* [ null, %21 ], [ %48, %32 ]
%38 = phi i8* [ null, %21 ], [ %26, %32 ]
br label %41
39: ; preds = %25
%40 = load i8*, i8** @optarg
br label %41
41: ; preds = %34, %39
%42 = phi i8* [ %36, %34 ], [ %40, %39 ]
%43 = phi i8* [ %37, %34 ], [ %48, %39 ]
%44 = phi i8* [ %38, %34 ], [ %26, %39 ]
br label %47
45: ; preds = %25
%46 = load i8*, i8** @optarg
br label %47
47: ; preds = %41, %45
%48 = phi i8* [ %43, %41 ], [ %46, %45 ]
%49 = phi i8* [ %44, %41 ], [ %26, %45 ]
br label %25
50: ; preds = %25
%51 = load i8*, i8** @optarg
br label %25
52: ; preds = %25
%53 = icmp eq i8* %26, null
br i1 %53, label %54, label %57
54: ; preds = %52
%55 = load i32, i32* @stderr
%56 = tail call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %70
57: ; preds = %52
%58 = icmp eq i8* %48, null
br i1 %58, label %68, label %59
59: ; preds = %57
%60 = icmp ne i8* %35, null
%61 = icmp ne i8* %42, null
%62 = select i1 %60, i1 true, i1 %61
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i32, i32* @stderr
%65 = tail call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.6, i64 0, i64 0))
br label %70
66: ; preds = %59
%67 = tail call i32 @cert_key(i8* %26, i8* %48)
br label %70
68: ; preds = %57
%69 = tail call i32 @url_key(i8* %26, i8* %35, i8* %42)
br label %70
70: ; preds = %66, %68, %63, %54, %22, %14, %4
%71 = phi i32 [ 1, %4 ], [ 0, %14 ], [ 0, %22 ], [ 1, %63 ], [ 1, %54 ], [ %67, %66 ], [ %69, %68 ]
ret i32 %71
}