#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ stripnl(char *);
int main(int argc, char **argv) {
  char vertag[128], lastlog[128], lasthash[128], *hash = NULL;
  FILE *stream = NULL;
  int gotrev = 0, needupdate = 1;
  vertag[0] = '\0';
  lastlog[0] = '\0';
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <path to gitinfo.h>\n", argv[0]);
    return 1;
  }
  stream = popen("git describe --tags --dirty=-m && git log -1 --format=%ai*%H",
                 "r");
  if (NULL != stream) {
    if (fgets(vertag, sizeof vertag, stream) == vertag &&
        fgets(lastlog, sizeof lastlog, stream) == lastlog) {
      stripnl(vertag);
      stripnl(lastlog);
      gotrev = 1;
    }
    pclose(stream);
  }
  if (gotrev) {
    hash = strchr(lastlog, '*');
    if (hash != NULL) {
      *hash = '\0';
      hash++;
    }
  }
  if (hash == NULL) {
    fprintf(stderr, "Failed to get commit info: %s\n", strerror(errno));
    strcpy(vertag, "<unknown version>");
    lastlog[0] = '\0';
    lastlog[1] = '0';
    lastlog[2] = '\0';
    hash = lastlog + 1;
  }
  stream = fopen(argv[1], "r");
  if (stream != NULL) {
    if (!gotrev) {
      fclose(stream);
      return 0;
    }
    if (fgets(lasthash, sizeof lasthash, stream) == lasthash) {
      stripnl(lasthash);
      if (strcmp(hash, lasthash + 3) == 0) {
        needupdate = 0;
      }
    }
    fclose(stream);
  }
  if (needupdate) {
    stream = fopen(argv[1], "w");
    if (stream == NULL) {
      return 1;
    }
    fprintf(stream,
            "// %s\n"
            "//\n"
            "// This file was automatically generated by the\n"
            "// updaterevision tool. Do not edit by hand.\n"
            "\n"
            "#define GIT_DESCRIPTION \"%s\"\n"
            "#define GIT_HASH \"%s\"\n"
            "#define GIT_TIME \"%s\"\n",
            hash, vertag, hash, lastlog);
    fclose(stream);
    fprintf(stderr, "%s updated to commit %s.\n", argv[1], vertag);
  } else {
    fprintf(stderr, "%s is up to date at commit %s.\n", argv[1], vertag);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x198(%rbp)
movq   $0x0,-0x1a0(%rbp)
movl   $0x0,-0x1a4(%rbp)
movl   $0x1,-0x1a8(%rbp)
movb   $0x0,-0x90(%rbp)
movb   $0x0,-0x110(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1235 <main+0x85>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1543 <main+0x393>
lea    0xde3(%rip),%rdi
lea    0xe19(%rip),%rsi
call   10b0 <popen@plt>
mov    %rax,-0x1a0(%rbp)
xor    %eax,%eax
cmp    -0x1a0(%rbp),%rax
je     12dc <main+0x12c>
lea    -0x90(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
lea    -0x90(%rbp),%rcx
cmp    %rcx,%rax
jne    12d0 <main+0x120>
lea    -0x110(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
lea    -0x110(%rbp),%rcx
cmp    %rcx,%rax
jne    12d0 <main+0x120>
lea    -0x90(%rbp),%rdi
call   1070 <stripnl@plt>
lea    -0x110(%rbp),%rdi
call   1070 <stripnl@plt>
movl   $0x1,-0x1a4(%rbp)
mov    -0x1a0(%rbp),%rdi
call   1060 <pclose@plt>
cmpl   $0x0,-0x1a4(%rbp)
je     1330 <main+0x180>
lea    -0x110(%rbp),%rdi
mov    $0x2a,%esi
call   1050 <strchr@plt>
mov    %rax,-0x198(%rbp)
cmpq   $0x0,-0x198(%rbp)
je     132b <main+0x17b>
mov    -0x198(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x198(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x198(%rbp)
jmp    1330 <main+0x180>
cmpq   $0x0,-0x198(%rbp)
jne    13ac <main+0x1fc>
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1ac(%rbp)
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1ac(%rbp),%edi
mov    %rax,%rdx
lea    0xcf3(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    -0x90(%rbp),%rdi
lea    0xcfd(%rip),%rsi
call   1030 <strcpy@plt>
movb   $0x0,-0x110(%rbp)
movb   $0x30,-0x10f(%rbp)
movb   $0x0,-0x10e(%rbp)
lea    -0x110(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x198(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xca1(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1a0(%rbp)
cmpq   $0x0,-0x1a0(%rbp)
je     146a <main+0x2ba>
cmpl   $0x0,-0x1a4(%rbp)
jne    13fa <main+0x24a>
mov    -0x1a0(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1543 <main+0x393>
lea    -0x190(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
lea    -0x190(%rbp),%rcx
cmp    %rcx,%rax
jne    145e <main+0x2ae>
lea    -0x190(%rbp),%rdi
call   1070 <stripnl@plt>
mov    -0x198(%rbp),%rdi
lea    -0x190(%rbp),%rsi
add    $0x3,%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1459 <main+0x2a9>
movl   $0x0,-0x1a8(%rbp)
jmp    145e <main+0x2ae>
mov    -0x1a0(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x1a8(%rbp)
je     1516 <main+0x366>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc09(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1a0(%rbp)
cmpq   $0x0,-0x1a0(%rbp)
jne    14ac <main+0x2fc>
movl   $0x1,-0x4(%rbp)
jmp    1543 <main+0x393>
mov    -0x1a0(%rbp),%rax
mov    %eax,%edi
mov    -0x198(%rbp),%rdx
lea    -0x90(%rbp),%rcx
mov    -0x198(%rbp),%r8
lea    -0x110(%rbp),%r9
lea    0xbb9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x1a0(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2aee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x90(%rbp),%rcx
lea    0xc38(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    153c <main+0x38c>
mov    0x2ac3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x90(%rbp),%rcx
lea    0xc27(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
mov    %rsi,%r15
movb   $0x0,0x80(%rsp)
movb   $0x0,(%rsp)
cmp    $0x2,%edi
jne    12be <main+0x10e>
lea    0xe3f(%rip),%rdi
lea    0xe75(%rip),%rsi
call   10b0 <popen@plt>
mov    $0x1,%bpl
test   %rax,%rax
je     1238 <main+0x88>
mov    %rax,%rbx
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
cmp    %r14,%rax
jne    1230 <main+0x80>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
cmp    %r14,%rax
je     12e2 <main+0x132>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%ebx
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xe08(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xe14(%rip),%rsi
lea    0x80(%rsp),%rdi
call   1030 <strcpy@plt>
movw   $0x3000,(%rsp)
lea    0x1(%rsp),%r14
movb   $0x0,0x2(%rsp)
mov    0x8(%r15),%rdi
add    $0x8,%r15
lea    0xdc7(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1389 <main+0x1d9>
mov    %rax,%rbx
test   %bpl,%bpl
je     133e <main+0x18e>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %ebx,%ebx
jmp    13f0 <main+0x240>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd2f(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%ebx
jmp    13f0 <main+0x240>
lea    0x80(%rsp),%rdi
call   1070 <stripnl@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1070 <stripnl@plt>
mov    %rbx,%rdi
call   1060 <pclose@plt>
mov    %r14,%rdi
mov    $0x2a,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     142b <main+0x27b>
mov    %rax,%r14
movb   $0x0,(%rax)
add    $0x1,%r14
mov    0x8(%r15),%rdi
add    $0x8,%r15
lea    0xd2b(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1389 <main+0x1d9>
lea    0x100(%rsp),%r12
mov    %r12,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
cmp    %r12,%rax
jne    1381 <main+0x1d1>
lea    0x100(%rsp),%rdi
call   1070 <stripnl@plt>
lea    0x103(%rsp),%rsi
mov    %r14,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1404 <main+0x254>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    (%r15),%rdi
lea    0xcfc(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     12d8 <main+0x128>
mov    %rax,%r12
lea    0xce6(%rip),%rsi
xor    %ebx,%ebx
lea    0x80(%rsp),%r13
mov    %rsp,%r9
mov    %r12d,%edi
mov    %r14,%rdx
mov    %r13,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    0x2c06(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd5c(%rip),%rsi
mov    %r13,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %ebx,%eax
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd3d(%rip),%rsi
xor    %ebx,%ebx
lea    0x80(%rsp),%rcx
jmp    13e9 <main+0x239>
xor    %ebp,%ebp
jmp    1238 <main+0x88>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: %s <path to gitinfo.h>\0A\00"
@.str.1 = [61 x i8] c"git describe --tags --dirty=-m && git log -1 --format=%ai*%H\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Failed to get commit info: %s\0A\00"
@errno = global i32 0
@.str.4 = [18 x i8] c"<unknown version>\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [177 x i8] c"// %s\0A//\0A// This file was automatically generated by the\0A// updaterevision tool. Do not edit by hand.\0A\0A#define GIT_DESCRIPTION \22%s\22\0A#define GIT_HASH \22%s\22\0A#define GIT_TIME \22%s\22\0A\00"
@.str.7 = [26 x i8] c"%s updated to commit %s.\0A\00"
@.str.8 = [32 x i8] c"%s is up to date at commit %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %9
store i32* null, i32** %10
store i32 0, i32* %11
store i32 1, i32* %12
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
store i8 0, i8* %13
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
store i8 0, i8* %14
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %21)
store i32 1, i32* %3
br label %142
23: ; preds = %2
%24 = call i32* @popen(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %10
%25 = load i32*, i32** %10
%26 = icmp ne i32* null, %25
br i1 %26, label %27, label %47
27: ; preds = %23
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%29 = load i32*, i32** %10
%30 = call i8* @fgets(i8* %28, i32 128, i32* %29)
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%32 = icmp eq i8* %30, %31
br i1 %32, label %33, label %44
33: ; preds = %27
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%35 = load i32*, i32** %10
%36 = call i8* @fgets(i8* %34, i32 128, i32* %35)
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%38 = icmp eq i8* %36, %37
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%41 = call i32 @stripnl(i8* %40)
%42 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%43 = call i32 @stripnl(i8* %42)
store i32 1, i32* %11
br label %44
44: ; preds = %39, %33, %27
%45 = load i32*, i32** %10
%46 = call i32 @pclose(i32* %45)
br label %47
47: ; preds = %44, %23
%48 = load i32, i32* %11
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %60
50: ; preds = %47
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%52 = call i8* @strchr(i8* %51, i8 signext 42)
store i8* %52, i8** %9
%53 = load i8*, i8** %9
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %59
55: ; preds = %50
%56 = load i8*, i8** %9
store i8 0, i8* %56
%57 = load i8*, i8** %9
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %9
br label %59
59: ; preds = %55, %50
br label %60
60: ; preds = %59, %47
%61 = load i8*, i8** %9
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %75
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %66)
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%69 = call i32 @strcpy(i8* %68, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
store i8 0, i8* %70
%71 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 1
store i8 48, i8* %71
%72 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 2
store i8 0, i8* %72
%73 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%74 = getelementptr inbounds i8, i8* %73, i64 1
store i8* %74, i8** %9
br label %75
75: ; preds = %63, %60
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 1
%78 = load i8*, i8** %77
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %79, i32** %10
%80 = load i32*, i32** %10
%81 = icmp ne i32* %80, null
br i1 %81, label %82, label %107
82: ; preds = %75
%83 = load i32, i32* %11
%84 = icmp ne i32 %83, 0
br i1 %84, label %88, label %85
85: ; preds = %82
%86 = load i32*, i32** %10
%87 = call i32 @fclose(i32* %86)
store i32 0, i32* %3
br label %142
88: ; preds = %82
%89 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%90 = load i32*, i32** %10
%91 = call i8* @fgets(i8* %89, i32 128, i32* %90)
%92 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%93 = icmp eq i8* %91, %92
br i1 %93, label %94, label %104
94: ; preds = %88
%95 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%96 = call i32 @stripnl(i8* %95)
%97 = load i8*, i8** %9
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%99 = getelementptr inbounds i8, i8* %98, i64 3
%100 = call i64 @strcmp(i8* %97, i8* %99)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %94
store i32 0, i32* %12
br label %103
103: ; preds = %102, %94
br label %104
104: ; preds = %103, %88
%105 = load i32*, i32** %10
%106 = call i32 @fclose(i32* %105)
br label %107
107: ; preds = %104, %75
%108 = load i32, i32* %12
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %134
110: ; preds = %107
%111 = load i8**, i8*** %5
%112 = getelementptr inbounds i8*, i8** %111, i64 1
%113 = load i8*, i8** %112
%114 = call i32* @fopen(i8* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %114, i32** %10
%115 = load i32*, i32** %10
%116 = icmp eq i32* %115, null
br i1 %116, label %117, label %118
117: ; preds = %110
store i32 1, i32* %3
br label %142
118: ; preds = %110
%119 = load i32*, i32** %10
%120 = ptrtoint i32* %119 to i32
%121 = load i8*, i8** %9
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%123 = load i8*, i8** %9
%124 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%125 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([177 x i8], [177 x i8]* @.str.6, i64 0, i64 0), i8* %121, i8* %122, i8* %123, i8* %124)
%126 = load i32*, i32** %10
%127 = call i32 @fclose(i32* %126)
%128 = load i32, i32* @stderr
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 1
%131 = load i8*, i8** %130
%132 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%133 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %131, i8* %132)
br label %141
134: ; preds = %107
%135 = load i32, i32* @stderr
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 1
%138 = load i8*, i8** %137
%139 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%140 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %138, i8* %139)
br label %141
141: ; preds = %134, %118
store i32 0, i32* %3
br label %142
142: ; preds = %141, %117, %85, %17
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Usage: %s <path to gitinfo.h>\0A\00"
@.str.1 = [61 x i8] c"git describe --tags --dirty=-m && git log -1 --format=%ai*%H\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Failed to get commit info: %s\0A\00"
@errno = global i32 0
@.str.4 = [18 x i8] c"<unknown version>\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [177 x i8] c"// %s\0A//\0A// This file was automatically generated by the\0A// updaterevision tool. Do not edit by hand.\0A\0A#define GIT_DESCRIPTION \22%s\22\0A#define GIT_HASH \22%s\22\0A#define GIT_TIME \22%s\22\0A\00"
@.str.7 = [26 x i8] c"%s updated to commit %s.\0A\00"
@.str.8 = [32 x i8] c"%s is up to date at commit %s.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
store i8 0, i8* %6
store i8 0, i8* %7
%9 = icmp eq i32 %0, 2
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %85
14: ; preds = %2
%15 = tail call i32* @popen(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %31, label %17
17: ; preds = %14
%18 = call i8* @fgets(i8* %6, i32 128, i32* %15)
%19 = icmp eq i8* %18, %6
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = call i8* @fgets(i8* %7, i32 128, i32* %15)
%22 = icmp eq i8* %21, %7
br i1 %22, label %25, label %23
23: ; preds = %20, %17
%24 = call i32 @pclose(i32* %15)
br label %31
25: ; preds = %20
%26 = call i32 @stripnl(i8* %6)
%27 = call i32 @stripnl(i8* %7)
%28 = call i32 @pclose(i32* %15)
%29 = call i8* @strchr(i8* %7, i8 signext 42)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %44
31: ; preds = %23, %25, %14
%32 = phi i1 [ true, %23 ], [ false, %25 ], [ true, %14 ]
%33 = load i32, i32* @stderr
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i8 0, i8* %7
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 1
store i8 48, i8* %38
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 2
store i8 0, i8* %39
%40 = getelementptr inbounds i8*, i8** %1, i64 1
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %66, label %50
44: ; preds = %25
store i8 0, i8* %29
%45 = getelementptr inbounds i8, i8* %29, i64 1
%46 = getelementptr inbounds i8*, i8** %1, i64 1
%47 = load i8*, i8** %46
%48 = call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %66, label %53
50: ; preds = %31
br i1 %32, label %51, label %53
51: ; preds = %50
%52 = call i32 @fclose(i32* %42)
br label %85
53: ; preds = %44, %50
%54 = phi i8* [ %38, %50 ], [ %45, %44 ]
%55 = phi i8** [ %40, %50 ], [ %46, %44 ]
%56 = phi i32* [ %42, %50 ], [ %48, %44 ]
%57 = call i8* @fgets(i8* %8, i32 128, i32* %56)
%58 = icmp eq i8* %57, %8
br i1 %58, label %59, label %64
59: ; preds = %53
%60 = call i32 @stripnl(i8* %8)
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 3
%62 = call i64 @strcmp(i8* %54, i8* %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %80, label %64
64: ; preds = %53, %59
%65 = call i32 @fclose(i32* %56)
br label %66
66: ; preds = %44, %31, %64
%67 = phi i8* [ %54, %64 ], [ %45, %44 ], [ %38, %31 ]
%68 = phi i8** [ %55, %64 ], [ %46, %44 ], [ %40, %31 ]
%69 = load i8*, i8** %68
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%71 = icmp eq i32* %70, null
br i1 %71, label %85, label %72
72: ; preds = %66
%73 = ptrtoint i32* %70 to i64
%74 = trunc i64 %73 to i32
%75 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([177 x i8], [177 x i8]* @.str.6, i64 0, i64 0), i8* %67, i8* %6, i8* %67, i8* %7)
%76 = call i32 @fclose(i32* %70)
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %68
%79 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %78, i8* %6)
br label %85
80: ; preds = %59
%81 = call i32 @fclose(i32* %56)
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %55
%84 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %83, i8* %6)
br label %85
85: ; preds = %72, %80, %66, %51, %10
%86 = phi i32 [ 1, %10 ], [ 0, %51 ], [ 1, %66 ], [ 0, %80 ], [ 0, %72 ]
ret i32 %86
}