#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 checkfile(char *);
int /*<<< orphan*/ lockcfile(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ unlockcfile(char *);
int main(int argc, char *argv[]) {
  int result = 0;
  int updatedaemon = 0;
  char srcfile[256] = "";
  char destfile[256] = "";
  char lockfile[256] = "";
  char updatingfile[256] = "";
  if (argc == 5) {
    argc = 4;
    updatedaemon = 1;
  }
  switch (argc) {
  case 4:
    sprintf(srcfile, "%s%s", argv[2], argv[1]);
    sprintf(destfile, "%s", argv[3]);
    sprintf(lockfile, "%s%s%s", argv[2], argv[1], ".lock");
    sprintf(updatingfile, "%s%s%s", argv[2], argv[1], ".update");
    if (checkfile(updatingfile) & checkfile(srcfile) & checkfile(destfile)) {
      char comm[512];
      while (checkfile(lockfile)) {
        sleep(1);
      }
      lockcfile(lockfile);
      sprintf(comm, "cp %s %s", srcfile, destfile);
      system(comm);
      if (updatedaemon == 1) {
        printf("UPDATING\n");
        system(argv[4]);
      }
      unlink(srcfile);
      unlockcfile(updatingfile);
      unlockcfile(lockfile);
      result = 1;
    }
    break;
  case 2:
    system(argv[1]);
    result = 1;
    break;
  default:
    printf("Usage: updater filename tempdir destdir updatecommand\n");
    printf("       updater filename tempdir destdir\n");
    printf("       updater command\n");
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x630,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
cmpl   $0x5,-0x8(%rbp)
jne    121b <main+0x8b>
movl   $0x4,-0x8(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x624(%rbp)
sub    $0x2,%eax
je     13e4 <main+0x254>
jmp    1232 <main+0xa2>
mov    -0x624(%rbp),%eax
sub    $0x4,%eax
jne    13fd <main+0x26d>
jmp    1246 <main+0xb6>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x320(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd5a(%rip),%rsi
lea    0xd5a(%rip),%r8
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd2e(%rip),%rsi
lea    0xd34(%rip),%r8
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1090 <checkfile@plt>
mov    %eax,-0x62c(%rbp)
lea    -0x120(%rbp),%rdi
call   1090 <checkfile@plt>
mov    %eax,%ecx
mov    -0x62c(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x628(%rbp)
lea    -0x220(%rbp),%rdi
call   1090 <checkfile@plt>
mov    %eax,%ecx
mov    -0x628(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
je     13df <main+0x24f>
jmp    1332 <main+0x1a2>
lea    -0x320(%rbp),%rdi
call   1090 <checkfile@plt>
cmp    $0x0,%eax
je     1356 <main+0x1c6>
mov    $0x1,%edi
call   10b0 <sleep@plt>
jmp    1332 <main+0x1a2>
lea    -0x320(%rbp),%rdi
call   1040 <lockcfile@plt>
lea    -0x620(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xc97(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x620(%rbp),%rdi
call   1050 <system@plt>
cmpl   $0x1,-0x18(%rbp)
jne    13b4 <main+0x224>
lea    0xc7c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1050 <system@plt>
lea    -0x120(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x420(%rbp),%rdi
call   1080 <unlockcfile@plt>
lea    -0x320(%rbp),%rdi
call   1080 <unlockcfile@plt>
movl   $0x1,-0x14(%rbp)
jmp    1421 <main+0x291>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <system@plt>
movl   $0x1,-0x14(%rbp)
jmp    1421 <main+0x291>
lea    0xc24(%rip),%rdi
call   1060 <printf@plt>
lea    0xc4f(%rip),%rdi
call   1060 <printf@plt>
lea    0xc6c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x630,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x608,%rsp
mov    %rsi,%r12
xorps  %xmm0,%xmm0
movaps %xmm0,0x2f0(%rsp)
movaps %xmm0,0x2e0(%rsp)
movaps %xmm0,0x2d0(%rsp)
movaps %xmm0,0x2c0(%rsp)
movaps %xmm0,0x2b0(%rsp)
movaps %xmm0,0x2a0(%rsp)
movaps %xmm0,0x290(%rsp)
movaps %xmm0,0x280(%rsp)
movaps %xmm0,0x270(%rsp)
movaps %xmm0,0x260(%rsp)
movaps %xmm0,0x250(%rsp)
movaps %xmm0,0x240(%rsp)
movaps %xmm0,0x230(%rsp)
movaps %xmm0,0x220(%rsp)
movaps %xmm0,0x210(%rsp)
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x3f0(%rsp)
movaps %xmm0,0x3e0(%rsp)
movaps %xmm0,0x3d0(%rsp)
movaps %xmm0,0x3c0(%rsp)
movaps %xmm0,0x3b0(%rsp)
movaps %xmm0,0x3a0(%rsp)
movaps %xmm0,0x390(%rsp)
movaps %xmm0,0x380(%rsp)
movaps %xmm0,0x370(%rsp)
movaps %xmm0,0x360(%rsp)
movaps %xmm0,0x350(%rsp)
movaps %xmm0,0x340(%rsp)
movaps %xmm0,0x330(%rsp)
movaps %xmm0,0x320(%rsp)
movaps %xmm0,0x310(%rsp)
movaps %xmm0,0x300(%rsp)
cmp    $0x5,%edi
mov    $0x4,%eax
cmovne %edi,%eax
cmp    $0x2,%eax
je     1504 <main+0x374>
cmp    $0x4,%eax
jne    1515 <main+0x385>
mov    %edi,%r14d
mov    0x8(%r12),%rcx
mov    0x10(%r12),%rdx
lea    0xc43(%rip),%rsi
xor    %ebp,%ebp
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    0x18(%r12),%rsi
lea    0x100(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x8(%r12),%rcx
mov    0x10(%r12),%rdx
lea    0xc0a(%rip),%r13
lea    0xc0a(%rip),%r8
mov    %rsp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    0x8(%r12),%rcx
mov    0x10(%r12),%rdx
lea    0xbf2(%rip),%r8
lea    0x300(%rsp),%r15
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %r15,%rdi
call   1090 <checkfile@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1090 <checkfile@plt>
mov    %eax,%ebx
and    %r15d,%ebx
lea    0x100(%rsp),%rdi
call   1090 <checkfile@plt>
test   %eax,%ebx
je     153b <main+0x3ab>
mov    %rsp,%rdi
call   1090 <checkfile@plt>
test   %eax,%eax
je     1486 <main+0x2f6>
mov    %rsp,%rbp
nopl   0x0(%rax)
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    %rbp,%rdi
call   1090 <checkfile@plt>
test   %eax,%eax
jne    1470 <main+0x2e0>
mov    %rsp,%rdi
call   1060 <lockcfile@plt>
lea    0xb80(%rip),%rsi
lea    0x400(%rsp),%rbx
lea    0x200(%rsp),%rdx
lea    0x100(%rsp),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <system@plt>
cmp    $0x5,%r14d
jne    14db <main+0x34b>
lea    0xb52(%rip),%rdi
call   1050 <puts@plt>
mov    0x20(%r12),%rdi
call   1070 <system@plt>
lea    0x200(%rsp),%rdi
call   1030 <unlink@plt>
lea    0x300(%rsp),%rdi
call   1080 <unlockcfile@plt>
mov    %rsp,%rdi
call   1080 <unlockcfile@plt>
mov    $0x1,%ebp
jmp    153b <main+0x3ab>
mov    0x8(%r12),%rdi
call   1070 <system@plt>
mov    $0x1,%ebp
jmp    153b <main+0x3ab>
lea    0xb0b(%rip),%rdi
call   1050 <puts@plt>
lea    0xb35(%rip),%rdi
call   1050 <puts@plt>
lea    0xb51(%rip),%rdi
call   1050 <puts@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x608,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%s\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [7 x i8] c"%s%s%s\00"
@.str.3 = [6 x i8] c".lock\00"
@.str.4 = [8 x i8] c".update\00"
@.str.5 = [9 x i8] c"cp %s %s\00"
@.str.6 = [10 x i8] c"UPDATING\0A\00"
@.str.7 = [55 x i8] c"Usage: updater filename tempdir destdir updatecommand\0A\00"
@.str.8 = [41 x i8] c" updater filename tempdir destdir\0A\00"
@.str.9 = [24 x i8] c" updater command\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 [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
%12 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%13 = bitcast [256 x i8]* %8 to i8*
%14 = bitcast [256 x i8]* %9 to i8*
%15 = bitcast [256 x i8]* %10 to i8*
%16 = bitcast [256 x i8]* %11 to i8*
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 5
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 4, i32* %4
store i32 1, i32* %7
br label %20
20: ; preds = %19, %2
%21 = load i32, i32* %4
switch i32 %21, label %98 [
i32 4, label %22
i32 2, label %93
]
22: ; preds = %20
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %29)
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %47, i8* %50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%53 = call i32 @checkfile(i8* %52)
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%55 = call i32 @checkfile(i8* %54)
%56 = and i32 %53, %55
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%58 = call i32 @checkfile(i8* %57)
%59 = and i32 %56, %58
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %92
61: ; preds = %22
br label %62
62: ; preds = %66, %61
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%64 = call i32 @checkfile(i8* %63)
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 @sleep(i32 1)
br label %62
68: ; preds = %62
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%70 = call i32 @lockcfile(i8* %69)
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%74 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %71, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %72, i8* %73)
%75 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%76 = call i32 @system(i8* %75)
%77 = load i32, i32* %7
%78 = icmp eq i32 %77, 1
br i1 %78, label %79, label %85
79: ; preds = %68
%80 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 4
%83 = load i8*, i8** %82
%84 = call i32 @system(i8* %83)
br label %85
85: ; preds = %79, %68
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%87 = call i32 @unlink(i8* %86)
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%89 = call i32 @unlockcfile(i8* %88)
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%91 = call i32 @unlockcfile(i8* %90)
store i32 1, i32* %6
br label %92
92: ; preds = %85, %22
br label %102
93: ; preds = %20
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 1
%96 = load i8*, i8** %95
%97 = call i32 @system(i8* %96)
store i32 1, i32* %6
br label %102
98: ; preds = %20
%99 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%100 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%101 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %102
102: ; preds = %98, %93, %92
%103 = load i32, i32* %6
ret i32 %103
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
@.str.2 = [7 x i8] c"%s%s%s\00"
@.str.3 = [6 x i8] c".lock\00"
@.str.4 = [8 x i8] c".update\00"
@.str.5 = [9 x i8] c"cp %s %s\00"
@str = [9 x i8] c"UPDATING\00"
@str.10 = [54 x i8] c"Usage: updater filename tempdir destdir updatecommand\00"
@str.11 = [40 x i8] c" updater filename tempdir destdir\00"
@str.12 = [23 x i8] c" updater command\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [512 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = icmp eq i32 %0, 5
%13 = select i1 %12, i32 4, i32 %0
switch i32 %13, label %60 [
i32 4, label %14
i32 2, label %56
]
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = call i8* @strcpy(i8* %9, i8* dereferenceable(1) %21)
%23 = load i8*, i8** %15
%24 = load i8*, i8** %17
%25 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%26 = load i8*, i8** %15
%27 = load i8*, i8** %17
%28 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @checkfile(i8* %11)
%30 = call i32 @checkfile(i8* %8)
%31 = and i32 %30, %29
%32 = call i32 @checkfile(i8* %9)
%33 = and i32 %31, %32
%34 = icmp eq i32 %33, 0
br i1 %34, label %64, label %35
35: ; preds = %14
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%37 = call i32 @checkfile(i8* %10)
%38 = icmp eq i32 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %35, %39
%40 = call i32 @sleep(i32 1)
%41 = call i32 @checkfile(i8* %10)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %39
43: ; preds = %39, %35
%44 = call i32 @lockcfile(i8* %10)
%45 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %8, i8* %9)
%46 = call i32 @system(i8* %36)
br i1 %12, label %47, label %52
47: ; preds = %43
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%49 = getelementptr inbounds i8*, i8** %1, i64 4
%50 = load i8*, i8** %49
%51 = call i32 @system(i8* %50)
br label %52
52: ; preds = %47, %43
%53 = call i32 @unlink(i8* %8)
%54 = call i32 @unlockcfile(i8* %11)
%55 = call i32 @unlockcfile(i8* %10)
br label %64
56: ; preds = %2
%57 = getelementptr inbounds i8*, i8** %1, i64 1
%58 = load i8*, i8** %57
%59 = tail call i32 @system(i8* %58)
br label %64
60: ; preds = %2
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.10, i64 0, i64 0))
%62 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.11, i64 0, i64 0))
%63 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
br label %64
64: ; preds = %14, %52, %60, %56
%65 = phi i32 [ 0, %60 ], [ 1, %56 ], [ 1, %52 ], [ 0, %14 ]
ret i32 %65
}