#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *getenv(char *);
void printJobIDs(FILE *out) {
  fprintf(out, "  jobids:\n");
  char *condor = getenv("CONDOR_JOBID");
  if (condor) {
    fprintf(out, "    condor: %s\n", condor);
  }
  char *gram = getenv("GLOBUS_GRAM_JOB_CONTACT");
  if (gram) {
    fprintf(out, "    gram: %s\n", gram);
  }
  char *lrm;
  lrm = getenv("SLURM_JOBID");
  if (lrm) {
    fprintf(out, "    lrmtype: slurm\n");
    fprintf(out, "    lrm: %s\n", lrm);
    goto end;
  }
  lrm = getenv("COBALT_JOBID");
  if (lrm) {
    fprintf(out, "    lrmtype: cobalt\n");
    fprintf(out, "    lrm: %s\n", lrm);
    goto end;
  }
  lrm = getenv("JOB_ID");
  if (lrm) {
    fprintf(out, "    lrmtype: sge\n");
    fprintf(out, "    lrm: %s\n", lrm);
    goto end;
  }
  lrm = getenv("LSB_JOBID");
  if (lrm) {
    fprintf(out, "    lrmtype: lsf\n");
    fprintf(out, "    lrm: %s\n", lrm);
    goto end;
  }
  lrm = getenv("PBS_JOBID");
  if (lrm) {
    fprintf(out, "    lrmtype: pbs\n");
    fprintf(out, "    lrm: %s\n", lrm);
    goto end;
  }
end:
  return;
}


x86 assembly (clang, -O0):
<printJobIDs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xec6(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116f <printJobIDs+0x4f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a0 <printJobIDs+0x80>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xea7(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11e8 <printJobIDs+0xc8>
mov    -0x8(%rbp),%rdi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <printJobIDs+0x1ed>
lea    0xe8c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1230 <printJobIDs+0x110>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <printJobIDs+0x1ed>
lea    0xe66(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1278 <printJobIDs+0x158>
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe02(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <printJobIDs+0x1ed>
lea    0xe37(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12c0 <printJobIDs+0x1a0>
mov    -0x8(%rbp),%rdi
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdba(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <printJobIDs+0x1ed>
lea    0xe0b(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1308 <printJobIDs+0x1e8>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <printJobIDs+0x1ed>
jmp    130d <printJobIDs+0x1ed>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printJobIDs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xeb4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1175 <printJobIDs+0x45>
lea    0xeb0(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xeac(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     119a <printJobIDs+0x6a>
lea    0xeb3(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xead(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11bc <printJobIDs+0x8c>
mov    %rax,%rbx
lea    0xea5(%rip),%rdi
mov    $0x13,%esi
jmp    1238 <printJobIDs+0x108>
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11de <printJobIDs+0xae>
mov    %rax,%rbx
lea    0xeb1(%rip),%rdi
mov    $0x14,%esi
jmp    1238 <printJobIDs+0x108>
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11fb <printJobIDs+0xcb>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
jmp    1233 <printJobIDs+0x103>
lea    0xeb4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1218 <printJobIDs+0xe8>
mov    %rax,%rbx
lea    0xeaa(%rip),%rdi
jmp    1233 <printJobIDs+0x103>
lea    0xeb3(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1260 <printJobIDs+0x130>
mov    %rax,%rbx
lea    0xea9(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xe22(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c" jobids:\0A\00"
@.str.1 = [13 x i8] c"CONDOR_JOBID\00"
@.str.2 = [16 x i8] c" condor: %s\0A\00"
@.str.3 = [24 x i8] c"GLOBUS_GRAM_JOB_CONTACT\00"
@.str.4 = [14 x i8] c" gram: %s\0A\00"
@.str.5 = [12 x i8] c"SLURM_JOBID\00"
@.str.6 = [20 x i8] c" lrmtype: slurm\0A\00"
@.str.7 = [13 x i8] c" lrm: %s\0A\00"
@.str.8 = [13 x i8] c"COBALT_JOBID\00"
@.str.9 = [21 x i8] c" lrmtype: cobalt\0A\00"
@.str.10 = [7 x i8] c"JOB_ID\00"
@.str.11 = [18 x i8] c" lrmtype: sge\0A\00"
@.str.12 = [10 x i8] c"LSB_JOBID\00"
@.str.13 = [18 x i8] c" lrmtype: lsf\0A\00"
@.str.14 = [10 x i8] c"PBS_JOBID\00"
@.str.15 = [18 x i8] c" lrmtype: pbs\0A\00"
define void @printJobIDs(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load i32*, i32** %2
%13 = load i8*, i8** %3
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11, %1
%16 = call i8* @getenv(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32*, i32** %2
%21 = load i8*, i8** %4
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %15
%24 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
store i8* %24, i8** %5
%25 = load i8*, i8** %5
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i32*, i32** %2
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%30 = load i32*, i32** %2
%31 = load i8*, i8** %5
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %31)
br label %74
33: ; preds = %23
%34 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
store i8* %34, i8** %5
%35 = load i8*, i8** %5
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load i32*, i32** %2
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%40 = load i32*, i32** %2
%41 = load i8*, i8** %5
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %41)
br label %74
43: ; preds = %33
%44 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
store i8* %44, i8** %5
%45 = load i8*, i8** %5
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32*, i32** %2
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%50 = load i32*, i32** %2
%51 = load i8*, i8** %5
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %51)
br label %74
53: ; preds = %43
%54 = call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
store i8* %54, i8** %5
%55 = load i8*, i8** %5
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %63
57: ; preds = %53
%58 = load i32*, i32** %2
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
%60 = load i32*, i32** %2
%61 = load i8*, i8** %5
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %61)
br label %74
63: ; preds = %53
%64 = call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
store i8* %64, i8** %5
%65 = load i8*, i8** %5
%66 = icmp ne i8* %65, null
br i1 %66, label %67, label %73
67: ; preds = %63
%68 = load i32*, i32** %2
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0))
%70 = load i32*, i32** %2
%71 = load i8*, i8** %5
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %71)
br label %74
73: ; preds = %63
br label %74
74: ; preds = %73, %67, %57, %47, %37, %27
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c" jobids:\0A\00"
@.str.1 = [13 x i8] c"CONDOR_JOBID\00"
@.str.2 = [16 x i8] c" condor: %s\0A\00"
@.str.3 = [24 x i8] c"GLOBUS_GRAM_JOB_CONTACT\00"
@.str.4 = [14 x i8] c" gram: %s\0A\00"
@.str.5 = [12 x i8] c"SLURM_JOBID\00"
@.str.6 = [20 x i8] c" lrmtype: slurm\0A\00"
@.str.7 = [13 x i8] c" lrm: %s\0A\00"
@.str.8 = [13 x i8] c"COBALT_JOBID\00"
@.str.9 = [21 x i8] c" lrmtype: cobalt\0A\00"
@.str.10 = [7 x i8] c"JOB_ID\00"
@.str.11 = [18 x i8] c" lrmtype: sge\0A\00"
@.str.12 = [10 x i8] c"LSB_JOBID\00"
@.str.13 = [18 x i8] c" lrmtype: lsf\0A\00"
@.str.14 = [10 x i8] c"PBS_JOBID\00"
@.str.15 = [18 x i8] c" lrmtype: pbs\0A\00"
define void @printJobIDs(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 10, i64 1, i32* %0)
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %7
7: ; preds = %5, %1
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %12
12: ; preds = %10, %7
%13 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%14 = icmp eq i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 19, i64 1, i32* %0)
br label %37
17: ; preds = %12
%18 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i64 20, i64 1, i32* %0)
br label %37
22: ; preds = %17
%23 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%24 = icmp eq i8* %23, null
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i64 17, i64 1, i32* %0)
br label %37
27: ; preds = %22
%28 = tail call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%29 = icmp eq i8* %28, null
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i64 17, i64 1, i32* %0)
br label %37
32: ; preds = %27
%33 = tail call i8* @getenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%34 = icmp eq i8* %33, null
br i1 %34, label %40, label %35
35: ; preds = %32
%36 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i64 17, i64 1, i32* %0)
br label %37
37: ; preds = %15, %20, %25, %30, %35
%38 = phi i8* [ %33, %35 ], [ %28, %30 ], [ %23, %25 ], [ %18, %20 ], [ %13, %15 ]
%39 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %37, %32
ret void
}