#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 */
char *GetOwner(char *, int);
int /*<<< orphan*/ Message(char *, int, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ unlink(char *);
void RunJob(char *queueDir, int jobID, int verbose) {
  char jobFile[240], pwd[240], job[240], exe[240], cmd[240];
  FILE *fp;
  sprintf(jobFile, "%s/%d", queueDir, jobID);
  if (verbose) {
    char msg[240];
    sprintf(msg, "Running job %d", jobID);
    Message("simq", 0, msg);
  }
  if ((fp = fopen(jobFile, "r")) != NULL) {
    char *username;
    username = GetOwner(queueDir, jobID);
    if (!fgets(pwd, 240, fp)) {
      char car_msg[240];
      sprintf(car_msg, "Invalid Job file (%d)", jobID);
      Message("simq", 1, car_msg);
      fclose(fp);
      return;
    };
    do {
      int _terminate_macro_j;
      for (_terminate_macro_j = 0; (pwd)[_terminate_macro_j];
           _terminate_macro_j++) {
        if ((pwd)[_terminate_macro_j] == '\n') {
          (pwd)[_terminate_macro_j] = '\0';
          break;
        }
      }
    } while (0);
    if (!fgets(job, 240, fp)) {
      char car_msg[240];
      sprintf(car_msg, "Invalid Job file (%d)", jobID);
      Message("simq", 1, car_msg);
      fclose(fp);
      return;
    };
    do {
      int _terminate_macro_j;
      for (_terminate_macro_j = 0; (job)[_terminate_macro_j];
           _terminate_macro_j++) {
        if ((job)[_terminate_macro_j] == '\n') {
          (job)[_terminate_macro_j] = '\0';
          break;
        }
      }
    } while (0);
    fclose(fp);
    sprintf(cmd, "(cd %s; %s)", pwd, job);
    sprintf(exe, "su - %s -c \"%s\"", username, cmd);
    if (verbose >= 2) {
      char msg[240];
      sprintf(msg, "Command is: %s", cmd);
      Message("simq", 0, msg);
    }
    if (verbose >= 3) {
      char msg[240];
      sprintf(msg, "Expanded command is: %s", exe);
      Message("simq", 0, msg);
    }
    system(exe);
    unlink(jobFile);
  }
}


x86 assembly (clang, -O0):
<RunJob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
cmpl   $0x0,-0x10(%rbp)
je     11e8 <RunJob+0x68>
lea    -0x5c0(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe3a(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x5c0(%rbp),%rdx
lea    0xe34(%rip),%rdi
xor    %esi,%esi
call   1060 <Message@plt>
lea    -0x100(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x4c8(%rbp)
cmp    $0x0,%rax
je     149f <RunJob+0x31f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <GetOwner@plt>
mov    %rax,-0x5c8(%rbp)
lea    -0x1f0(%rbp),%rdi
mov    -0x4c8(%rbp),%rdx
mov    $0xf0,%esi
call   1070 <fgets@plt>
cmp    $0x0,%eax
jne    1281 <RunJob+0x101>
lea    -0x6c0(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x6c0(%rbp),%rdx
lea    0xdaf(%rip),%rdi
mov    $0x1,%esi
call   1060 <Message@plt>
mov    -0x4c8(%rbp),%rdi
call   1040 <fclose@plt>
jmp    149f <RunJob+0x31f>
jmp    1286 <RunJob+0x106>
movl   $0x0,-0x6c4(%rbp)
movslq -0x6c4(%rbp),%rax
cmpb   $0x0,-0x1f0(%rbp,%rax,1)
je     12ea <RunJob+0x16a>
movslq -0x6c4(%rbp),%rax
movsbl -0x1f0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    12d1 <RunJob+0x151>
movslq -0x6c4(%rbp),%rax
movb   $0x0,-0x1f0(%rbp,%rax,1)
jmp    12ea <RunJob+0x16a>
jmp    12d6 <RunJob+0x156>
mov    -0x6c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c4(%rbp)
jmp    1290 <RunJob+0x110>
jmp    12ef <RunJob+0x16f>
lea    -0x2e0(%rbp),%rdi
mov    -0x4c8(%rbp),%rdx
mov    $0xf0,%esi
call   1070 <fgets@plt>
cmp    $0x0,%eax
jne    1351 <RunJob+0x1d1>
lea    -0x7c0(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xcfb(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x7c0(%rbp),%rdx
lea    0xcdf(%rip),%rdi
mov    $0x1,%esi
call   1060 <Message@plt>
mov    -0x4c8(%rbp),%rdi
call   1040 <fclose@plt>
jmp    149f <RunJob+0x31f>
jmp    1356 <RunJob+0x1d6>
movl   $0x0,-0x7c4(%rbp)
movslq -0x7c4(%rbp),%rax
cmpb   $0x0,-0x2e0(%rbp,%rax,1)
je     13ba <RunJob+0x23a>
movslq -0x7c4(%rbp),%rax
movsbl -0x2e0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    13a1 <RunJob+0x221>
movslq -0x7c4(%rbp),%rax
movb   $0x0,-0x2e0(%rbp,%rax,1)
jmp    13ba <RunJob+0x23a>
jmp    13a6 <RunJob+0x226>
mov    -0x7c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c4(%rbp)
jmp    1360 <RunJob+0x1e0>
jmp    13bf <RunJob+0x23f>
mov    -0x4c8(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x4c0(%rbp),%rdi
lea    -0x1f0(%rbp),%rdx
lea    -0x2e0(%rbp),%rcx
lea    0xc4b(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x3d0(%rbp),%rdi
mov    -0x5c8(%rbp),%rdx
lea    -0x4c0(%rbp),%rcx
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
cmpl   $0x2,-0x10(%rbp)
jl     144c <RunJob+0x2cc>
lea    -0x8c0(%rbp),%rdi
lea    -0x4c0(%rbp),%rdx
lea    0xc1e(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x8c0(%rbp),%rdx
lea    0xbd0(%rip),%rdi
xor    %esi,%esi
call   1060 <Message@plt>
cmpl   $0x3,-0x10(%rbp)
jl     1487 <RunJob+0x307>
lea    -0x9b0(%rbp),%rdi
lea    -0x3d0(%rbp),%rdx
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x9b0(%rbp),%rdx
lea    0xb95(%rip),%rdi
xor    %esi,%esi
call   1060 <Message@plt>
lea    -0x3d0(%rbp),%rdi
call   1050 <system@plt>
lea    -0x100(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x9b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RunJob>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5a8,%rsp
mov    %edx,%r14d
mov    %esi,%r13d
mov    %rdi,%rbx
lea    0xe5f(%rip),%rsi
lea    0x2d0(%rsp),%rdi
mov    %rbx,%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   10a0 <sprintf@plt>
test   %r14d,%r14d
je     11e8 <RunJob+0x68>
lea    0xe44(%rip),%rsi
lea    0xf0(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xe37(%rip),%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1060 <Message@plt>
lea    0xe2b(%rip),%rsi
lea    0x2d0(%rsp),%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     13b8 <RunJob+0x238>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %r13d,%esi
call   1080 <GetOwner@plt>
mov    %rax,%r15
lea    0xf0(%rsp),%rdi
mov    $0xf0,%esi
mov    %r12,%rdx
call   1070 <fgets@plt>
test   %eax,%eax
je     1257 <RunJob+0xd7>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0xf0(%rsp,%rax,1),%ecx
test   %cl,%cl
je     126d <RunJob+0xed>
cmp    $0xa,%cl
je     1263 <RunJob+0xe3>
add    $0x1,%rax
jmp    1240 <RunJob+0xc0>
lea    0xdbe(%rip),%rsi
mov    %rsp,%rbx
jmp    12b2 <RunJob+0x132>
mov    %eax,%eax
movb   $0x0,0xf0(%rsp,%rax,1)
mov    %rsp,%rdi
mov    $0xf0,%esi
mov    %r12,%rdx
call   1070 <fgets@plt>
test   %eax,%eax
je     12a3 <RunJob+0x123>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsp,%rax,1),%ecx
test   %cl,%cl
je     12e6 <RunJob+0x166>
cmp    $0xa,%cl
je     12e0 <RunJob+0x160>
add    $0x1,%rax
jmp    1290 <RunJob+0x110>
lea    0xd72(%rip),%rsi
lea    0x1e0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xd4f(%rip),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1060 <Message@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
jmp    13b8 <RunJob+0x238>
mov    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %r12,%rdi
call   1040 <fclose@plt>
lea    0xd3d(%rip),%rsi
lea    0x4b0(%rsp),%rbx
lea    0xf0(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xd25(%rip),%rsi
lea    0x1e0(%rsp),%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   10a0 <sprintf@plt>
cmp    $0x2,%r14d
jl     139e <RunJob+0x21e>
lea    0xd13(%rip),%rsi
lea    0x3c0(%rsp),%rbx
lea    0x4b0(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xcb9(%rip),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <Message@plt>
cmp    $0x2,%r14d
je     139e <RunJob+0x21e>
lea    0xcea(%rip),%rsi
lea    0x3c0(%rsp),%rbx
lea    0x1e0(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xc81(%rip),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <Message@plt>
lea    0x1e0(%rsp),%rdi
call   1050 <system@plt>
lea    0x2d0(%rsp),%rdi
call   1030 <unlink@plt>
add    $0x5a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%d\00"
@.str.1 = [15 x i8] c"Running job %d\00"
@.str.2 = [5 x i8] c"simq\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"Invalid Job file (%d)\00"
@.str.5 = [12 x i8] c"(cd %s; %s)\00"
@.str.6 = [16 x i8] c"su - %s -c \22%s\22\00"
@.str.7 = [15 x i8] c"Command is: %s\00"
@.str.8 = [24 x i8] c"Expanded command is: %s\00"
define void @RunJob(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [240 x i8]
%8 = alloca [240 x i8]
%9 = alloca [240 x i8]
%10 = alloca [240 x i8]
%11 = alloca [240 x i8]
%12 = alloca i32*
%13 = alloca [240 x i8]
%14 = alloca i8*
%15 = alloca [240 x i8]
%16 = alloca i32
%17 = alloca [240 x i8]
%18 = alloca i32
%19 = alloca [240 x i8]
%20 = alloca [240 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%21 = getelementptr inbounds [240 x i8], [240 x i8]* %7, i64 0, i64 0
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %22, i32 %23)
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %3
%28 = getelementptr inbounds [240 x i8], [240 x i8]* %13, i64 0, i64 0
%29 = load i32, i32* %5
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %28, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [240 x i8], [240 x i8]* %13, i64 0, i64 0
%32 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %31)
br label %33
33: ; preds = %27, %3
%34 = getelementptr inbounds [240 x i8], [240 x i8]* %7, i64 0, i64 0
%35 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %35, i32** %12
%36 = icmp ne i32* %35, null
br i1 %36, label %37, label %147
37: ; preds = %33
%38 = load i8*, i8** %4
%39 = load i32, i32* %5
%40 = call i8* @GetOwner(i8* %38, i32 %39)
store i8* %40, i8** %14
%41 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 0
%42 = load i32*, i32** %12
%43 = call i32 @fgets(i8* %41, i32 240, i32* %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %53, label %45
45: ; preds = %37
%46 = getelementptr inbounds [240 x i8], [240 x i8]* %15, i64 0, i64 0
%47 = load i32, i32* %5
%48 = call i32 (i8*, i8*, ...) @sprintf(i8* %46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [240 x i8], [240 x i8]* %15, i64 0, i64 0
%50 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* %49)
%51 = load i32*, i32** %12
%52 = call i32 @fclose(i32* %51)
br label %147
53: ; preds = %37
br label %54
54: ; preds = %53
store i32 0, i32* %16
br label %55
55: ; preds = %73, %54
%56 = load i32, i32* %16
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = icmp ne i8 %59, 0
br i1 %60, label %61, label %76
61: ; preds = %55
%62 = load i32, i32* %16
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 10
br i1 %67, label %68, label %72
68: ; preds = %61
%69 = load i32, i32* %16
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 %70
store i8 0, i8* %71
br label %76
72: ; preds = %61
br label %73
73: ; preds = %72
%74 = load i32, i32* %16
%75 = add nsw i32 %74, 1
store i32 %75, i32* %16
br label %55
76: ; preds = %68, %55
br label %77
77: ; preds = %76
%78 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 0
%79 = load i32*, i32** %12
%80 = call i32 @fgets(i8* %78, i32 240, i32* %79)
%81 = icmp ne i32 %80, 0
br i1 %81, label %90, label %82
82: ; preds = %77
%83 = getelementptr inbounds [240 x i8], [240 x i8]* %17, i64 0, i64 0
%84 = load i32, i32* %5
%85 = call i32 (i8*, i8*, ...) @sprintf(i8* %83, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %84)
%86 = getelementptr inbounds [240 x i8], [240 x i8]* %17, i64 0, i64 0
%87 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* %86)
%88 = load i32*, i32** %12
%89 = call i32 @fclose(i32* %88)
br label %147
90: ; preds = %77
br label %91
91: ; preds = %90
store i32 0, i32* %18
br label %92
92: ; preds = %110, %91
%93 = load i32, i32* %18
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 %94
%96 = load i8, i8* %95
%97 = icmp ne i8 %96, 0
br i1 %97, label %98, label %113
98: ; preds = %92
%99 = load i32, i32* %18
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 10
br i1 %104, label %105, label %109
105: ; preds = %98
%106 = load i32, i32* %18
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 %107
store i8 0, i8* %108
br label %113
109: ; preds = %98
br label %110
110: ; preds = %109
%111 = load i32, i32* %18
%112 = add nsw i32 %111, 1
store i32 %112, i32* %18
br label %92
113: ; preds = %105, %92
br label %114
114: ; preds = %113
%115 = load i32*, i32** %12
%116 = call i32 @fclose(i32* %115)
%117 = getelementptr inbounds [240 x i8], [240 x i8]* %11, i64 0, i64 0
%118 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 0
%119 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 0
%120 = call i32 (i8*, i8*, ...) @sprintf(i8* %117, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %118, i8* %119)
%121 = getelementptr inbounds [240 x i8], [240 x i8]* %10, i64 0, i64 0
%122 = load i8*, i8** %14
%123 = getelementptr inbounds [240 x i8], [240 x i8]* %11, i64 0, i64 0
%124 = call i32 (i8*, i8*, ...) @sprintf(i8* %121, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %122, i8* %123)
%125 = load i32, i32* %6
%126 = icmp sge i32 %125, 2
br i1 %126, label %127, label %133
127: ; preds = %114
%128 = getelementptr inbounds [240 x i8], [240 x i8]* %19, i64 0, i64 0
%129 = getelementptr inbounds [240 x i8], [240 x i8]* %11, i64 0, i64 0
%130 = call i32 (i8*, i8*, ...) @sprintf(i8* %128, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %129)
%131 = getelementptr inbounds [240 x i8], [240 x i8]* %19, i64 0, i64 0
%132 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %131)
br label %133
133: ; preds = %127, %114
%134 = load i32, i32* %6
%135 = icmp sge i32 %134, 3
br i1 %135, label %136, label %142
136: ; preds = %133
%137 = getelementptr inbounds [240 x i8], [240 x i8]* %20, i64 0, i64 0
%138 = getelementptr inbounds [240 x i8], [240 x i8]* %10, i64 0, i64 0
%139 = call i32 (i8*, i8*, ...) @sprintf(i8* %137, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* %138)
%140 = getelementptr inbounds [240 x i8], [240 x i8]* %20, i64 0, i64 0
%141 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %140)
br label %142
142: ; preds = %136, %133
%143 = getelementptr inbounds [240 x i8], [240 x i8]* %10, i64 0, i64 0
%144 = call i32 @system(i8* %143)
%145 = getelementptr inbounds [240 x i8], [240 x i8]* %7, i64 0, i64 0
%146 = call i32 @unlink(i8* %145)
br label %147
147: ; preds = %45, %82, %142, %33
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%d\00"
@.str.1 = [15 x i8] c"Running job %d\00"
@.str.2 = [5 x i8] c"simq\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [22 x i8] c"Invalid Job file (%d)\00"
@.str.5 = [12 x i8] c"(cd %s; %s)\00"
@.str.6 = [16 x i8] c"su - %s -c \22%s\22\00"
@.str.7 = [15 x i8] c"Command is: %s\00"
@.str.8 = [24 x i8] c"Expanded command is: %s\00"
define void @RunJob(i8* %0, i32 %1, i32 %2) {
%4 = alloca [240 x i8]
%5 = alloca [240 x i8]
%6 = alloca [240 x i8]
%7 = alloca [240 x i8]
%8 = alloca [240 x i8]
%9 = alloca [240 x i8]
%10 = alloca [240 x i8]
%11 = alloca [240 x i8]
%12 = alloca [240 x i8]
%13 = alloca [240 x i8]
%14 = getelementptr inbounds [240 x i8], [240 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [240 x i8], [240 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [240 x i8], [240 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [240 x i8], [240 x i8]* %7, i64 0, i64 0
%18 = getelementptr inbounds [240 x i8], [240 x i8]* %8, i64 0, i64 0
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%20 = icmp eq i32 %2, 0
br i1 %20, label %25, label %21
21: ; preds = %3
%22 = getelementptr inbounds [240 x i8], [240 x i8]* %9, i64 0, i64 0
%23 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%24 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %22)
br label %25
25: ; preds = %21, %3
%26 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %80, label %28
28: ; preds = %25
%29 = call i8* @GetOwner(i8* %0, i32 %1)
%30 = call i32 @fgets(i8* %15, i32 240, i32* %26)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = getelementptr inbounds [240 x i8], [240 x i8]* %10, i64 0, i64 0
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%35 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* %33)
%36 = call i32 @fclose(i32* %26)
br label %80
37: ; preds = %28, %44
%38 = phi i64 [ %45, %44 ], [ 0, %28 ]
%39 = getelementptr inbounds [240 x i8], [240 x i8]* %5, i64 0, i64 %38
%40 = load i8, i8* %39
switch i8 %40, label %44 [
i8 0, label %46
i8 10, label %41
]
41: ; preds = %37
%42 = and i64 %38, 4294967295
%43 = getelementptr inbounds [240 x i8], [240 x i8]* %5, i64 0, i64 %42
store i8 0, i8* %43
br label %46
44: ; preds = %37
%45 = add nuw i64 %38, 1
br label %37
46: ; preds = %37, %41
%47 = call i32 @fgets(i8* %16, i32 240, i32* %26)
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = getelementptr inbounds [240 x i8], [240 x i8]* %11, i64 0, i64 0
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %50, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%52 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1, i8* %50)
%53 = call i32 @fclose(i32* %26)
br label %80
54: ; preds = %46, %61
%55 = phi i64 [ %62, %61 ], [ 0, %46 ]
%56 = getelementptr inbounds [240 x i8], [240 x i8]* %6, i64 0, i64 %55
%57 = load i8, i8* %56
switch i8 %57, label %61 [
i8 0, label %63
i8 10, label %58
]
58: ; preds = %54
%59 = and i64 %55, 4294967295
%60 = getelementptr inbounds [240 x i8], [240 x i8]* %6, i64 0, i64 %59
store i8 0, i8* %60
br label %63
61: ; preds = %54
%62 = add nuw i64 %55, 1
br label %54
63: ; preds = %54, %58
%64 = call i32 @fclose(i32* %26)
%65 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %15, i8* %16)
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %29, i8* %18)
%67 = icmp sgt i32 %2, 1
br i1 %67, label %68, label %77
68: ; preds = %63
%69 = getelementptr inbounds [240 x i8], [240 x i8]* %12, i64 0, i64 0
%70 = call i32 (i8*, i8*, ...) @sprintf(i8* %69, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %18)
%71 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %69)
%72 = icmp eq i32 %2, 2
br i1 %72, label %77, label %73
73: ; preds = %68
%74 = getelementptr inbounds [240 x i8], [240 x i8]* %13, i64 0, i64 0
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %74, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* %17)
%76 = call i32 @Message(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* %74)
br label %77
77: ; preds = %63, %73, %68
%78 = call i32 @system(i8* %17)
%79 = call i32 @unlink(i8* %14)
br label %80
80: ; preds = %25, %77, %32, %49
ret void
}