#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$"));
    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    0xe14(%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    0xdd5(%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    0xd24(%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    0xcf4(%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    11ab <main+0x2b>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
mov    $0x1,%ebx
jmp    12fd <main+0x17d>
mov    %rsi,%r15
mov    %edi,%ebp
jle    11e4 <main+0x64>
mov    0x8(%r15),%rdi
lea    0xe43(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12a7 <main+0x127>
mov    0x8(%r15),%rdi
lea    0xe4f(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12ed <main+0x16d>
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe3a(%rip),%r14
mov    0x2dff(%rip),%r13
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
jmp    1214 <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     1210 <main+0x90>
cmp    $0x6a,%eax
jg     123f <main+0xbf>
cmp    $0xffffffff,%eax
je     1263 <main+0xe3>
cmp    $0x66,%eax
jne    130e <main+0x18e>
mov    0x0(%r13),%r12
jmp    1214 <main+0x94>
cmp    $0x6b,%eax
je     1258 <main+0xd8>
cmp    $0x75,%eax
jne    130e <main+0x18e>
mov    0x0(%r13),%rax
mov    %rax,0x8(%rsp)
jmp    1214 <main+0x94>
mov    0x0(%r13),%rax
mov    %rax,0x10(%rsp)
jmp    1214 <main+0x94>
test   %rbx,%rbx
je     128b <main+0x10b>
mov    0x10(%rsp),%rsi
test   %rsi,%rsi
je     12b9 <main+0x139>
or     0x8(%rsp),%r12
je     12d7 <main+0x157>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xdbf(%rip),%rsi
jmp    129b <main+0x11b>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%ebx
jmp    12fd <main+0x17d>
lea    0xd5c(%rip),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
call   1040 <printf@plt>
jmp    12fd <main+0x17d>
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    0x2cdc(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   1080 <usage@plt>
xor    %edi,%edi
call   10a0 <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 = [11 x i8] c"$Revision$\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 ([11 x i8], [11 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.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 %69
7: ; preds = %2
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %20
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 %16
14: ; preds = %9
%15 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %69
16: ; preds = %9
%17 = load i8*, i8** %10
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %7, %16
br label %33
21: ; preds = %16
%22 = load i32, i32* @stdout
%23 = tail call i32 @usage(i32 %22)
br label %69
24: ; preds = %46, %49
%25 = phi i8* [ %50, %49 ], [ %48, %46 ]
%26 = 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 %26, label %27 [
i32 -1, label %51
i32 110, label %49
i32 102, label %31
i32 117, label %38
i32 107, label %44
]
27: ; preds = %24
%28 = load i32, i32* @stdout
%29 = tail call i32 @usage(i32 %28)
%30 = tail call i32 @exit(i32 0)
unreachable
31: ; preds = %24
%32 = load i8*, i8** @optarg
br label %33
33: ; preds = %20, %31
%34 = phi i8* [ null, %20 ], [ %32, %31 ]
%35 = phi i8* [ null, %20 ], [ %41, %31 ]
%36 = phi i8* [ null, %20 ], [ %47, %31 ]
%37 = phi i8* [ null, %20 ], [ %25, %31 ]
br label %40
38: ; preds = %24
%39 = load i8*, i8** @optarg
br label %40
40: ; preds = %33, %38
%41 = phi i8* [ %35, %33 ], [ %39, %38 ]
%42 = phi i8* [ %36, %33 ], [ %47, %38 ]
%43 = phi i8* [ %37, %33 ], [ %25, %38 ]
br label %46
44: ; preds = %24
%45 = load i8*, i8** @optarg
br label %46
46: ; preds = %40, %44
%47 = phi i8* [ %42, %40 ], [ %45, %44 ]
%48 = phi i8* [ %43, %40 ], [ %25, %44 ]
br label %24
49: ; preds = %24
%50 = load i8*, i8** @optarg
br label %24
51: ; preds = %24
%52 = icmp eq i8* %25, null
br i1 %52, label %53, label %56
53: ; preds = %51
%54 = load i32, i32* @stderr
%55 = tail call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %69
56: ; preds = %51
%57 = icmp eq i8* %47, null
br i1 %57, label %67, label %58
58: ; preds = %56
%59 = icmp ne i8* %34, null
%60 = icmp ne i8* %41, null
%61 = select i1 %59, i1 true, i1 %60
br i1 %61, label %62, label %65
62: ; preds = %58
%63 = load i32, i32* @stderr
%64 = tail call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.6, i64 0, i64 0))
br label %69
65: ; preds = %58
%66 = tail call i32 @cert_key(i8* %25, i8* %47)
br label %69
67: ; preds = %56
%68 = tail call i32 @url_key(i8* %25, i8* %34, i8* %41)
br label %69
69: ; preds = %65, %67, %62, %53, %21, %14, %4
%70 = phi i32 [ 1, %4 ], [ 0, %14 ], [ 0, %21 ], [ 1, %62 ], [ 1, %53 ], [ %66, %65 ], [ %68, %67 ]
ret i32 %70
}