#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 */
struct utimbuf {
  scalar_t__ modtime;
  scalar_t__ actime;
};

/* Variables and functions */
scalar_t__ EPERM;
scalar_t__ errno;
scalar_t__ getenv(char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ utime(char *, struct utimbuf *);
int main(int argc, char **argv) {
  struct utimbuf t;
  if (argc < 2)
    return 125;
  t.actime = 0;
  t.modtime = 0;
  if (utime(argv[1], &t) < 0) {
    if (getenv("PANDORA_TEST_SUCCESS")) {
      perror("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/"
             "t012_utime.c");
      return 1;
    } else if (getenv("PANDORA_TEST_EPERM") && errno == EPERM)
      return 0;
    perror("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/"
           "t012_utime.c");
    return 1;
  }
  return getenv("PANDORA_TEST_SUCCESS") ? 0 : 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115c <main+0x2c>
movl   $0x7d,-0x4(%rbp)
jmp    122e <main+0xfe>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <utime@plt>
cmp    $0x0,%rax
jge    120e <main+0xde>
lea    0xe72(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11b5 <main+0x85>
lea    0xe71(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <main+0xfe>
lea    0xee5(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11f1 <main+0xc1>
mov    0x2e0e(%rip),%rax
mov    (%rax),%rax
mov    0x2df4(%rip),%rcx
cmp    (%rcx),%rax
jne    11f1 <main+0xc1>
movl   $0x0,-0x4(%rbp)
jmp    122e <main+0xfe>
jmp    11f6 <main+0xc6>
lea    0xe18(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <main+0xfe>
lea    0xdeb(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x7d,%eax
cmp    $0x2,%edi
jl     11a3 <main+0x73>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   1040 <utime@plt>
mov    %rax,%rbx
lea    0xea4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
test   %rbx,%rbx
js     1175 <main+0x45>
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
jmp    11a3 <main+0x73>
test   %rcx,%rcx
jne    11a9 <main+0x79>
lea    0xf20(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11a9 <main+0x79>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rcx
mov    0x2e34(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
jne    11a9 <main+0x79>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe65(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%eax
jmp    11a3 <main+0x73>

LLVM IR (-O0):
%struct.utimbuf = type { i64, i64 }
@.str = [21 x i8] c"PANDORA_TEST_SUCCESS\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/t012_utime.c\00"
@.str.2 = [19 x i8] c"PANDORA_TEST_EPERM\00"
@errno = global i64 0
@EPERM = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.utimbuf
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 125, i32* %3
br label %39
10: ; preds = %2
%11 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 1
store i64 0, i64* %11
%12 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 0
store i64 0, i64* %12
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @utime(i8* %15, %struct.utimbuf* %6)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %34
18: ; preds = %10
%19 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %39
23: ; preds = %18
%24 = call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i64, i64* @errno
%28 = load i64, i64* @EPERM
%29 = icmp eq i64 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 0, i32* %3
br label %39
31: ; preds = %26, %23
br label %32
32: ; preds = %31
%33 = call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %39
34: ; preds = %10
%35 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
%37 = zext i1 %36 to i64
%38 = select i1 %36, i32 0, i32 2
store i32 %38, i32* %3
br label %39
39: ; preds = %34, %32, %30, %21, %9
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
%struct.utimbuf = type { i64, i64 }
@.str = [21 x i8] c"PANDORA_TEST_SUCCESS\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/t012_utime.c\00"
@.str.2 = [19 x i8] c"PANDORA_TEST_EPERM\00"
@errno = global i64 0
@EPERM = global i64 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.utimbuf
%4 = bitcast %struct.utimbuf* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %28, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = bitcast %struct.utimbuf* %3 to i8*
%9 = load i8*, i8** %7
%10 = call i64 @utime(i8* %9, %struct.utimbuf* %3)
%11 = icmp slt i64 %10, 0
%12 = tail call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %11, label %14, label %26
14: ; preds = %6
br i1 %13, label %17, label %15
15: ; preds = %14
%16 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %28
17: ; preds = %14
%18 = tail call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i64, i64* @errno
%22 = load i64, i64* @EPERM
%23 = icmp eq i64 %21, %22
br i1 %23, label %28, label %24
24: ; preds = %17, %20
%25 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %28
26: ; preds = %6
%27 = select i1 %13, i32 2, i32 0
br label %28
28: ; preds = %20, %2, %26, %24, %15
%29 = phi i32 [ 1, %15 ], [ 1, %24 ], [ %27, %26 ], [ 125, %2 ], [ 0, %20 ]
ret i32 %29
}