#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
unsigned long strtoul(char *, char **, int);
int main(int argc, char **argv) {
  unsigned int version = 0;
  unsigned char v[4];
  unsigned int ix;
  unsigned long major;
  unsigned long minor = 0;
  char phase = 0;
  char *ptr;
  if (argc != 3) {
    fprintf(stderr, "usage: %s 'version' 'phase'\n", argv[0]);
    return 1;
  }
  ptr = argv[1];
  major = strtoul(ptr, &ptr, 10);
  if (*ptr == '.')
    minor = strtoul(ptr + 1, 0, 10);
  phase = argv[2][0];
  if (phase == '\0')
    phase = '*';
  v[0] = (major < 10 ? '0' : 'A' - 10) + major;
  v[1] = (minor / 10) + '0';
  v[2] = (minor % 10) + '0';
  v[3] = phase;
  for (ix = 0; ix != 4; ix++)
    version = (version << 8) | v[ix];
  printf("/* Generated automatically by the program `%s'\n", argv[0]);
  printf("   from `%s (%lu %lu) and %s (%c)'.  */\n", argv[1], major, minor,
         argv[2], phase);
  printf("\n");
  printf("#define GCOV_VERSION ((gcov_unsigned_t)%#08x)  /* %.4s */\n", version,
         v);
  return 0;
}


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   $0x0,-0x14(%rbp)
movq   $0x0,-0x30(%rbp)
movb   $0x0,-0x31(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118b <main+0x5b>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12e1 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,-0x28(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d7 <main+0xa7>
mov    -0x40(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x0,%eax
jne    11f5 <main+0xc5>
movb   $0x2a,-0x31(%rbp)
mov    -0x28(%rbp),%rdx
mov    $0x37,%eax
mov    $0x30,%ecx
cmp    $0xa,%rdx
cmovb  %ecx,%eax
cltq
add    -0x28(%rbp),%rax
mov    %al,-0x18(%rbp)
mov    -0x30(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    $0x30,%rax
mov    %al,-0x17(%rbp)
mov    -0x30(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    $0x30,%rdx
mov    %dl,%al
mov    %al,-0x16(%rbp)
mov    -0x31(%rbp),%al
mov    %al,-0x15(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
je     1277 <main+0x147>
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    -0x1c(%rbp),%ecx
movzbl -0x18(%rbp,%rcx,1),%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124c <main+0x11c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8
movsbl -0x31(%rbp),%r9d
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    -0x18(%rbp),%rdx
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-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
mov    %rsi,%r13
cmp    $0x3,%edi
jne    1193 <main+0x53>
mov    0x8(%r13),%rdi
mov    %rdi,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtoul@plt>
mov    %rax,%r15
mov    0x10(%rsp),%rdi
xor    %r14d,%r14d
cmpb   $0x2e,(%rdi)
jne    11b7 <main+0x77>
add    $0x1,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtoul@plt>
mov    %rax,%r12
jmp    11ba <main+0x7a>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xe59(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r14d
jmp    127c <main+0x13c>
xor    %r12d,%r12d
mov    0x10(%r13),%rax
movzbl (%rax),%eax
test   %al,%al
mov    $0x2a,%ecx
cmovne %eax,%ecx
lea    0x37(%r15),%rsi
lea    0x30(%r15),%rax
cmp    $0xa,%r15
cmovb  %rax,%rsi
movabs $0xcccccccccccccccd,%rdx
cc cc cc
mov    %r12,%rax
mul    %rdx
mov    %sil,0xc(%rsp)
shr    $0x3,%rdx
lea    0x30(%rdx),%eax
mov    %al,0xd(%rsp)
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
mov    %r12d,%edi
sub    %edx,%edi
or     $0x30,%dil
mov    %dil,0xe(%rsp)
mov    %cl,0xf(%rsp)
movzbl %al,%eax
movzbl %dil,%ebp
shl    $0x18,%esi
shl    $0x10,%eax
or     %esi,%eax
shl    $0x8,%ebp
or     %eax,%ebp
movzbl %cl,%ebx
or     %ebx,%ebp
mov    0x0(%r13),%rsi
lea    0xde7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r13),%rsi
mov    0x10(%r13),%r8
movsbl %bl,%r9d
lea    0xdfd(%rip),%rdi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe08(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s 'version' 'phase'\0A\00"
@.str.1 = [48 x i8] c"/* Generated automatically by the program `%s'\0A\00"
@.str.2 = [41 x i8] c" from `%s (%lu %lu) and %s (%c)'. */\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [59 x i8] c"#define GCOV_VERSION ((gcov_unsigned_t)%x) /* %.4s */\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i8]
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i64 0, i64* %10
store i8 0, i8* %11
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %102
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %12
%25 = load i8*, i8** %12
%26 = call i64 @strtoul(i8* %25, i8** %12, i32 10)
store i64 %26, i64* %9
%27 = load i8*, i8** %12
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 46
br i1 %30, label %31, label %35
31: ; preds = %21
%32 = load i8*, i8** %12
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i64 @strtoul(i8* %33, i8** null, i32 10)
store i64 %34, i64* %10
br label %35
35: ; preds = %31, %21
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 0
%40 = load i8, i8* %39
store i8 %40, i8* %11
%41 = load i8, i8* %11
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %35
store i8 42, i8* %11
br label %45
45: ; preds = %44, %35
%46 = load i64, i64* %9
%47 = icmp ult i64 %46, 10
%48 = zext i1 %47 to i64
%49 = select i1 %47, i32 48, i32 55
%50 = sext i32 %49 to i64
%51 = load i64, i64* %9
%52 = add i64 %50, %51
%53 = trunc i64 %52 to i8
%54 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
store i8 %53, i8* %54
%55 = load i64, i64* %10
%56 = udiv i64 %55, 10
%57 = add i64 %56, 48
%58 = trunc i64 %57 to i8
%59 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
store i8 %58, i8* %59
%60 = load i64, i64* %10
%61 = urem i64 %60, 10
%62 = add i64 %61, 48
%63 = trunc i64 %62 to i8
%64 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 2
store i8 %63, i8* %64
%65 = load i8, i8* %11
%66 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
store i8 %65, i8* %66
store i32 0, i32* %8
br label %67
67: ; preds = %79, %45
%68 = load i32, i32* %8
%69 = icmp ne i32 %68, 4
br i1 %69, label %70, label %82
70: ; preds = %67
%71 = load i32, i32* %6
%72 = shl i32 %71, 8
%73 = load i32, i32* %8
%74 = zext i32 %73 to i64
%75 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = or i32 %72, %77
store i32 %78, i32* %6
br label %79
79: ; preds = %70
%80 = load i32, i32* %8
%81 = add i32 %80, 1
store i32 %81, i32* %8
br label %67
82: ; preds = %67
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 0
%85 = load i8*, i8** %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %85)
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 1
%89 = load i8*, i8** %88
%90 = load i64, i64* %9
%91 = load i64, i64* %10
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 2
%94 = load i8*, i8** %93
%95 = load i8, i8* %11
%96 = sext i8 %95 to i32
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %89, i64 %90, i64 %91, i8* %94, i32 %96)
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%99 = load i32, i32* %6
%100 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 %99, i8* %100)
store i32 0, i32* %3
br label %102
102: ; preds = %82, %15
%103 = load i32, i32* %3
ret i32 %103
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s 'version' 'phase'\0A\00"
@.str.1 = [48 x i8] c"/* Generated automatically by the program `%s'\0A\00"
@.str.2 = [41 x i8] c" from `%s (%lu %lu) and %s (%c)'. */\0A\00"
@.str.4 = [59 x i8] c"#define GCOV_VERSION ((gcov_unsigned_t)%x) /* %.4s */\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i8]
%4 = alloca i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = bitcast i8** %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %60
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
store i8* %14, i8** %4
%15 = call i64 @strtoul(i8* %14, i8** %4, i32 10)
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 46
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = getelementptr inbounds i8, i8* %16, i64 1
%21 = tail call i64 @strtoul(i8* nocapture %20, i8** null, i32 10)
br label %22
22: ; preds = %19, %12
%23 = phi i64 [ %21, %19 ], [ 0, %12 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
%28 = select i1 %27, i8 42, i8 %26
%29 = icmp ult i64 %15, 10
%30 = select i1 %29, i64 48, i64 55
%31 = add i64 %30, %15
%32 = trunc i64 %31 to i8
store i8 %32, i8* %5
%33 = udiv i64 %23, 10
%34 = trunc i64 %33 to i8
%35 = add i8 %34, 48
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %35, i8* %36
%37 = urem i64 %23, 10
%38 = trunc i64 %37 to i8
%39 = or i8 %38, 48
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %39, i8* %40
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 %28, i8* %41
%42 = trunc i64 %31 to i32
%43 = zext i8 %35 to i32
%44 = zext i8 %39 to i32
%45 = shl i32 %42, 24
%46 = shl nuw nsw i32 %43, 16
%47 = or i32 %45, %46
%48 = shl nuw nsw i32 %44, 8
%49 = or i32 %47, %48
%50 = zext i8 %28 to i32
%51 = or i32 %49, %50
%52 = load i8*, i8** %1
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %52)
%54 = load i8*, i8** %13
%55 = load i8*, i8** %24
%56 = sext i8 %28 to i32
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %54, i64 %15, i64 %23, i8* %55, i32 %56)
%58 = tail call i32 @putchar(i32 10)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 %51, i8* %5)
br label %60
60: ; preds = %22, %8
%61 = phi i32 [ 1, %8 ], [ 0, %22 ]
ret i32 %61
}