#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*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
int atoi(char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int, int, char *,
                           int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int counter = 0, interval = 30, fontsize = 40;
  char text[200];
  time_t rawtime;
  struct tm *timeinfo;
  int argpos = 1;
  while (argpos < argc) {
    if (strcmp(argv[argpos], "help") == 0) {
      printf("Usage: desktopcapture [ OPTIONS ]\n");
      printf(
          "Where OPTIONS is a combination of one or more of the following:\n");
      printf(
          "--counter | -c : defaults to zero, indicates first frame counter\n");
      printf("--interval | -i : defaults to 30 seconds, sets the interval  "
             "between frames\n");
      printf("--fontsize | -f : defaults to 40, change accordingly to your "
             "desktop resolution\n");
      printf("--help | -h : shows this message. Any other parameter is "
             "ignored.\n");
      printf("Parameters may be passed in any given order. \n");
      return 0;
    } else if (strcmp(argv[argpos], "--counter") == 0 ||
               strcmp(argv[argpos], "-c") == 0) {
      counter = atoi(argv[argpos + 1]);
      if (counter < 0)
        counter = 0;
      argpos += 2;
    } else if (strcmp(argv[argpos], "--interval") == 0 ||
               strcmp(argv[argpos], "-i") == 0) {
      interval = atoi(argv[argpos + 1]);
      if (interval <= 0)
        interval = 30;
      argpos += 2;
    } else if (strcmp(argv[argpos], "--fontsize") == 0 &&
               strcmp(argv[argpos], "-f") == 0) {
      fontsize = atoi(argv[argpos + 1]);
      if (fontsize < 8)
        fontsize = 40;
      argpos += 2;
    } else {
      printf("Error! Unknown \"%s\" parameter. Bailing out.\n", argv[argpos]);
      return -1;
    }
  }
  while (1) {
    printf("Waiting %i seconds. Presss CTRL+C to quit (quick'n'dirty).\n",
           interval);
    usleep(1000000 * interval);
    printf("Capturing image desktop%010i.jpg\n", counter);
    system("import -window root desktemp.png");
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    sprintf(text,
            "convert desktemp.png -pointsize %i -stroke black -strokewidth 1 "
            "-fill white -draw \"text 50,%i '%s'\" desktop%010i.jpg",
            fontsize, fontsize, asctime(timeinfo), counter++);
    system(text);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1e,-0x18(%rbp)
movl   $0x28,-0x1c(%rbp)
movl   $0x1,-0x104(%rbp)
mov    -0x104(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1448 <main+0x2b8>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe13(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    126a <main+0xda>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xf35(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1518 <main+0x388>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xf3b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     12b4 <main+0x124>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xf20(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12f5 <main+0x165>
mov    -0x10(%rbp),%rax
mov    -0x104(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12e1 <main+0x151>
movl   $0x0,-0x14(%rbp)
mov    -0x104(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x104(%rbp)
jmp    143e <main+0x2ae>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xebd(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     133f <main+0x1af>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xea3(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1380 <main+0x1f0>
mov    -0x10(%rbp),%rax
mov    -0x104(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     136c <main+0x1dc>
movl   $0x1e,-0x18(%rbp)
mov    -0x104(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x104(%rbp)
jmp    1439 <main+0x2a9>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe40(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    140b <main+0x27b>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe26(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    140b <main+0x27b>
mov    -0x10(%rbp),%rax
mov    -0x104(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    13f7 <main+0x267>
movl   $0x28,-0x1c(%rbp)
mov    -0x104(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x104(%rbp)
jmp    1434 <main+0x2a4>
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1518 <main+0x388>
jmp    1439 <main+0x2a9>
jmp    143e <main+0x2ae>
jmp    1443 <main+0x2b3>
jmp    11c8 <main+0x38>
jmp    144d <main+0x2bd>
mov    -0x18(%rbp),%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
imul   $0xf4240,-0x18(%rbp),%edi
call   10b0 <usleep@plt>
mov    -0x14(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xded(%rip),%rdi
call   1050 <system@plt>
lea    -0xf4(%rbp),%rdi
call   1080 <time@plt>
lea    -0xf4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x100(%rbp)
lea    -0xf0(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x110(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x100(%rbp),%rdi
call   1040 <asctime@plt>
mov    -0x118(%rbp),%rdi
mov    -0x110(%rbp),%edx
mov    -0x10c(%rbp),%ecx
mov    %rax,%r8
mov    -0x14(%rbp),%r9d
mov    %r9d,%eax
add    $0x1,%eax
mov    %eax,-0x108(%rbp)
mov    %eax,-0x14(%rbp)
lea    0xd8e(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
call   1050 <system@plt>
jmp    144d <main+0x2bd>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
cmp    $0x2,%edi
jl     12dd <main+0x13d>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%r14d
lea    0xe33(%rip),%rbp
mov    $0x28,%r13d
movl   $0x1e,0x8(%rsp)
xor    %ebx,%ebx
jmp    1203 <main+0x63>
nop
mov    0x8(%r15,%r14,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
mov    $0x0,%eax
cmovs  %eax,%ebx
add    $0x2,%r14
cmp    %r12d,%r14d
jge    12ed <main+0x14d>
mov    (%r15,%r14,8),%rdi
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1389 <main+0x1e9>
mov    (%r15,%r14,8),%rdi
lea    0xde2(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0x40>
mov    (%r15,%r14,8),%rdi
lea    0xdd7(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11e0 <main+0x40>
mov    (%r15,%r14,8),%rdi
lea    0xdc5(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12c0 <main+0x120>
mov    (%r15,%r14,8),%rdi
lea    0xdbb(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12c0 <main+0x120>
mov    (%r15,%r14,8),%rdi
lea    0xda9(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    13e1 <main+0x241>
mov    (%r15,%r14,8),%rdi
lea    0xd9b(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    13e1 <main+0x241>
mov    0x8(%r15,%r14,8),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r13d
cmp    $0x8,%eax
mov    $0x28,%eax
cmovl  %eax,%r13d
jmp    11f6 <main+0x56>
nopl   0x0(%rax)
mov    0x8(%r15,%r14,8),%rdi
call   10a0 <atoi@plt>
test   %eax,%eax
mov    $0x1e,%ecx
cmovle %ecx,%eax
mov    %eax,0x8(%rsp)
jmp    11f6 <main+0x56>
mov    $0x28,%r13d
movl   $0x1e,0x8(%rsp)
xor    %ebx,%ebx
mov    0x8(%rsp),%esi
imul   $0xf4240,%esi,%ebp
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd44(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   10c0 <usleep@plt>
lea    0xd6b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd7d(%rip),%rdi
call   1060 <system@plt>
mov    %r15,%rdi
call   1090 <time@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1050 <asctime@plt>
lea    0x1(%rbx),%r12d
mov    %r14,%rdi
lea    0xd73(%rip),%rsi
mov    %r13d,%edx
mov    %r13d,%ecx
mov    %rax,%r8
mov    %ebx,%r9d
call   10b0 <sprintf@plt>
mov    %r14,%rdi
call   1060 <system@plt>
mov    %r12d,%ebx
mov    0x8(%rsp),%esi
jmp    1310 <main+0x170>
lea    0xdbf(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd5(%rip),%rdi
call   1040 <puts@plt>
lea    0xe09(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xef8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    13f8 <main+0x258>
mov    (%r15,%r14,8),%rsi
lea    0xc42(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [5 x i8] c"help\00"
@.str.1 = [35 x i8] c"Usage: desktopcapture [ OPTIONS ]\0A\00"
@.str.2 = [65 x i8] c"Where OPTIONS is a combination of one or more of the following:\0A\00"
@.str.3 = [66 x i8] c"--counter | -c : defaults to zero, indicates first frame counter\0A\00"
@.str.4 = [77 x i8] c"--interval | -i : defaults to 30 seconds, sets the interval between frames\0A\00"
@.str.5 = [81 x i8] c"--fontsize | -f : defaults to 40, change accordingly to your desktop resolution\0A\00"
@.str.6 = [67 x i8] c"--help | -h : shows this message. Any other parameter is ignored.\0A\00"
@.str.7 = [47 x i8] c"Parameters may be passed in any given order. \0A\00"
@.str.8 = [10 x i8] c"--counter\00"
@.str.9 = [3 x i8] c"-c\00"
@.str.10 = [11 x i8] c"--interval\00"
@.str.11 = [3 x i8] c"-i\00"
@.str.12 = [11 x i8] c"--fontsize\00"
@.str.13 = [3 x i8] c"-f\00"
@.str.14 = [45 x i8] c"Error! Unknown \22%s\22 parameter. Bailing out.\0A\00"
@.str.15 = [60 x i8] c"Waiting %i seconds. Presss CTRL+C to quit (quick'n'dirty).\0A\00"
@.str.16 = [34 x i8] c"Capturing image desktop%010i.jpg\0A\00"
@.str.17 = [33 x i8] c"import -window root desktemp.png\00"
@.str.18 = [117 x i8] c"convert desktemp.png -pointsize %i -stroke black -strokewidth 1 -fill white -draw \22text 50,%i '%s'\22 desktop%010i.jpg\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 i32
%9 = alloca [200 x i8]
%10 = alloca i32
%11 = alloca %struct.tm*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 30, i32* %7
store i32 40, i32* %8
store i32 1, i32* %12
br label %13
13: ; preds = %133, %2
%14 = load i32, i32* %12
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %134
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %12
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %17
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %156
33: ; preds = %17
%34 = load i8**, i8*** %5
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %33
%42 = load i8**, i8*** %5
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %63
49: ; preds = %41, %33
%50 = load i8**, i8*** %5
%51 = load i32, i32* %12
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %6
%57 = load i32, i32* %6
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %60
59: ; preds = %49
store i32 0, i32* %6
br label %60
60: ; preds = %59, %49
%61 = load i32, i32* %12
%62 = add nsw i32 %61, 2
store i32 %62, i32* %12
br label %132
63: ; preds = %41
%64 = load i8**, i8*** %5
%65 = load i32, i32* %12
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %79, label %71
71: ; preds = %63
%72 = load i8**, i8*** %5
%73 = load i32, i32* %12
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %93
79: ; preds = %71, %63
%80 = load i8**, i8*** %5
%81 = load i32, i32* %12
%82 = add nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %80, i64 %83
%85 = load i8*, i8** %84
%86 = call i32 @atoi(i8* %85)
store i32 %86, i32* %7
%87 = load i32, i32* %7
%88 = icmp sle i32 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %79
store i32 30, i32* %7
br label %90
90: ; preds = %89, %79
%91 = load i32, i32* %12
%92 = add nsw i32 %91, 2
store i32 %92, i32* %12
br label %131
93: ; preds = %71
%94 = load i8**, i8*** %5
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8*, i8** %94, i64 %96
%98 = load i8*, i8** %97
%99 = call i64 @strcmp(i8* %98, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %123
101: ; preds = %93
%102 = load i8**, i8*** %5
%103 = load i32, i32* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8*, i8** %102, i64 %104
%106 = load i8*, i8** %105
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %123
109: ; preds = %101
%110 = load i8**, i8*** %5
%111 = load i32, i32* %12
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8*, i8** %110, i64 %113
%115 = load i8*, i8** %114
%116 = call i32 @atoi(i8* %115)
store i32 %116, i32* %8
%117 = load i32, i32* %8
%118 = icmp slt i32 %117, 8
br i1 %118, label %119, label %120
119: ; preds = %109
store i32 40, i32* %8
br label %120
120: ; preds = %119, %109
%121 = load i32, i32* %12
%122 = add nsw i32 %121, 2
store i32 %122, i32* %12
br label %130
123: ; preds = %101, %93
%124 = load i8**, i8*** %5
%125 = load i32, i32* %12
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %124, i64 %126
%128 = load i8*, i8** %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), i8* %128)
store i32 -1, i32* %3
br label %156
130: ; preds = %120
br label %131
131: ; preds = %130, %90
br label %132
132: ; preds = %131, %60
br label %133
133: ; preds = %132
br label %13
134: ; preds = %13
br label %135
135: ; preds = %134, %135
%136 = load i32, i32* %7
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.15, i64 0, i64 0), i32 %136)
%138 = load i32, i32* %7
%139 = mul nsw i32 1000000, %138
%140 = call i32 @usleep(i32 %139)
%141 = load i32, i32* %6
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %141)
%143 = call i32 @system(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%144 = call i32 @time(i32* %10)
%145 = call %struct.tm* @localtime(i32* %10)
store %struct.tm* %145, %struct.tm** %11
%146 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%147 = load i32, i32* %8
%148 = load i32, i32* %8
%149 = load %struct.tm*, %struct.tm** %11
%150 = call i8* @asctime(%struct.tm* %149)
%151 = load i32, i32* %6
%152 = add nsw i32 %151, 1
store i32 %152, i32* %6
%153 = call i32 @sprintf(i8* %146, i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str.18, i64 0, i64 0), i32 %147, i32 %148, i8* %150, i32 %151)
%154 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%155 = call i32 @system(i8* %154)
br label %135
156: ; preds = %123, %25
%157 = load i32, i32* %3
ret i32 %157
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [5 x i8] c"help\00"
@.str.8 = [10 x i8] c"--counter\00"
@.str.9 = [3 x i8] c"-c\00"
@.str.10 = [11 x i8] c"--interval\00"
@.str.11 = [3 x i8] c"-i\00"
@.str.12 = [11 x i8] c"--fontsize\00"
@.str.13 = [3 x i8] c"-f\00"
@.str.14 = [45 x i8] c"Error! Unknown \22%s\22 parameter. Bailing out.\0A\00"
@.str.15 = [60 x i8] c"Waiting %i seconds. Presss CTRL+C to quit (quick'n'dirty).\0A\00"
@.str.16 = [34 x i8] c"Capturing image desktop%010i.jpg\0A\00"
@.str.17 = [33 x i8] c"import -window root desktemp.png\00"
@.str.18 = [117 x i8] c"convert desktemp.png -pointsize %i -stroke black -strokewidth 1 -fill white -draw \22text 50,%i '%s'\22 desktop%010i.jpg\00"
@str = [34 x i8] c"Usage: desktopcapture [ OPTIONS ]\00"
@str.19 = [64 x i8] c"Where OPTIONS is a combination of one or more of the following:\00"
@str.20 = [65 x i8] c"--counter | -c : defaults to zero, indicates first frame counter\00"
@str.21 = [76 x i8] c"--interval | -i : defaults to 30 seconds, sets the interval between frames\00"
@str.22 = [80 x i8] c"--fontsize | -f : defaults to 40, change accordingly to your desktop resolution\00"
@str.23 = [66 x i8] c"--help | -h : shows this message. Any other parameter is ignored.\00"
@str.24 = [46 x i8] c"Parameters may be passed in any given order. \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [200 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
%7 = icmp sgt i32 %0, 1
br i1 %7, label %13, label %8
8: ; preds = %78, %2
%9 = phi i32 [ 0, %2 ], [ %79, %78 ]
%10 = phi i32 [ 30, %2 ], [ %80, %78 ]
%11 = phi i32 [ 40, %2 ], [ %81, %78 ]
%12 = mul nsw i32 %10, 1000000
br label %85
13: ; preds = %2, %78
%14 = phi i64 [ %82, %78 ], [ 1, %2 ]
%15 = phi i32 [ %81, %78 ], [ 40, %2 ]
%16 = phi i32 [ %80, %78 ], [ 30, %2 ]
%17 = phi i32 [ %79, %78 ], [ 0, %2 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %14
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %13
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.19, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.20, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.21, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.22, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.23, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.24, i64 0, i64 0))
br label %97
30: ; preds = %13
%31 = load i8*, i8** %18
%32 = tail call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8*, i8** %18
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %34, %30
%39 = add nuw nsw i64 %14, 1
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = tail call i32 @atoi(i8* %41)
%43 = icmp sgt i32 %42, 0
%44 = select i1 %43, i32 %42, i32 0
br label %78
45: ; preds = %34
%46 = load i8*, i8** %18
%47 = tail call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %53, label %49
49: ; preds = %45
%50 = load i8*, i8** %18
%51 = tail call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %60
53: ; preds = %49, %45
%54 = add nuw nsw i64 %14, 1
%55 = getelementptr inbounds i8*, i8** %1, i64 %54
%56 = load i8*, i8** %55
%57 = tail call i32 @atoi(i8* %56)
%58 = icmp slt i32 %57, 1
%59 = select i1 %58, i32 30, i32 %57
br label %78
60: ; preds = %49
%61 = load i8*, i8** %18
%62 = tail call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %75
64: ; preds = %60
%65 = load i8*, i8** %18
%66 = tail call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %64
%69 = add nuw nsw i64 %14, 1
%70 = getelementptr inbounds i8*, i8** %1, i64 %69
%71 = load i8*, i8** %70
%72 = tail call i32 @atoi(i8* %71)
%73 = icmp slt i32 %72, 8
%74 = select i1 %73, i32 40, i32 %72
br label %78
75: ; preds = %64, %60
%76 = load i8*, i8** %18
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), i8* %76)
br label %97
78: ; preds = %38, %68, %53
%79 = phi i32 [ %44, %38 ], [ %17, %53 ], [ %17, %68 ]
%80 = phi i32 [ %16, %38 ], [ %59, %53 ], [ %16, %68 ]
%81 = phi i32 [ %15, %38 ], [ %15, %53 ], [ %74, %68 ]
%82 = add nuw i64 %14, 2
%83 = trunc i64 %82 to i32
%84 = icmp slt i32 %83, %0
br i1 %84, label %13, label %8
85: ; preds = %8, %85
%86 = phi i32 [ %94, %85 ], [ %9, %8 ]
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.15, i64 0, i64 0), i32 %10)
%88 = call i32 @usleep(i32 %12)
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i32 %86)
%90 = call i32 @system(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%91 = call i32 @time(i32* %4)
%92 = call %struct.tm* @localtime(i32* %4)
%93 = call i8* @asctime(%struct.tm* %92)
%94 = add nsw i32 %86, 1
%95 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([117 x i8], [117 x i8]* @.str.18, i64 0, i64 0), i32 %11, i32 %11, i8* %93, i32 %86)
%96 = call i32 @system(i8* %5)
br label %85
97: ; preds = %75, %22
%98 = phi i32 [ 0, %22 ], [ -1, %75 ]
ret i32 %98
}