#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 passwd {
  int /*<<< orphan*/ pw_name;
};

/* Variables and functions */
int /*<<< orphan*/ execle(char *, char *, char *, int /*<<< orphan*/, char *,
                          char *, int /*<<< orphan*/ *, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <test-type> <project-name>\n", argv[0]);
    fprintf(stderr, "<test-type> is either public or secret\n");
    fprintf(stderr,
            "<project-name> is the name of a project from Marmoset web page\n");
    return 1;
  }
  struct passwd *realpwd = getpwuid(getuid());
  if (!realpwd) {
    return 1;
  }
  char *empty_env[] = {};
  execle("/usr/bin/racket", "/usr/bin/racket",
         "/u/cs136/marmoset-scripts/get-test-results/get-test-results.rkt",
         realpwd->pw_name, argv[1], argv[2], NULL, empty_env);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b8 <main+0x78>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1227 <main+0xe7>
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,%edi
call   1030 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e1 <main+0xa1>
movl   $0x1,-0x4(%rbp)
jmp    1227 <main+0xe7>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r9
lea    -0x20(%rbp),%rax
lea    0xe8c(%rip),%rsi
lea    0xe95(%rip),%rdx
xor    %edi,%edi
mov    %rsi,%rdi
movq   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <execle@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    118c <main+0x4c>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %eax,%edi
call   1030 <getpwuid@plt>
test   %rax,%rax
je     11c9 <main+0x89>
mov    (%rax),%ecx
mov    0x8(%rbx),%r8
mov    0x10(%rbx),%r9
mov    %rsp,%rax
lea    0xf1a(%rip),%rdi
lea    0xf23(%rip),%rdx
mov    %rdi,%rsi
push   %rax
push   $0x0
call   1060 <execle@plt>
add    $0x10,%rsp
jmp    11ce <main+0x8e>
mov    0x2e4d(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xe60(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe75(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe8c(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s <test-type> <project-name>\0A\00"
@.str.1 = [40 x i8] c"<test-type> is either public or secret\0A\00"
@.str.2 = [64 x i8] c"<project-name> is the name of a project from Marmoset web page\0A\00"
@.str.3 = [16 x i8] c"/usr/bin/racket\00"
@.str.4 = [64 x i8] c"/u/cs136/marmoset-scripts/get-test-results/get-test-results.rkt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.passwd*
%7 = alloca [0 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %39
20: ; preds = %2
%21 = call i32 (...) @getuid()
%22 = call %struct.passwd* @getpwuid(i32 %21)
store %struct.passwd* %22, %struct.passwd** %6
%23 = load %struct.passwd*, %struct.passwd** %6
%24 = icmp ne %struct.passwd* %23, null
br i1 %24, label %26, label %25
25: ; preds = %20
store i32 1, i32* %3
br label %39
26: ; preds = %20
%27 = bitcast [0 x i8*]* %7 to i8*
%28 = load %struct.passwd*, %struct.passwd** %6
%29 = getelementptr inbounds %struct.passwd, %struct.passwd* %28, i32 0, i32 0
%30 = load i32, i32* %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = getelementptr inbounds [0 x i8*], [0 x i8*]* %7, i64 0, i64 0
%38 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i32 %30, i8* %33, i8* %36, i32* null, i8** %37)
store i32 0, i32* %3
br label %39
39: ; preds = %26, %25, %10
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s <test-type> <project-name>\0A\00"
@.str.1 = [40 x i8] c"<test-type> is either public or secret\0A\00"
@.str.2 = [64 x i8] c"<project-name> is the name of a project from Marmoset web page\0A\00"
@.str.3 = [16 x i8] c"/usr/bin/racket\00"
@.str.4 = [64 x i8] c"/u/cs136/marmoset-scripts/get-test-results/get-test-results.rkt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [0 x i8*]
%4 = icmp eq i32 %0, 3
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
br label %27
13: ; preds = %2
%14 = tail call i32 (...) @getuid()
%15 = tail call %struct.passwd* @getpwuid(i32 %14)
%16 = icmp eq %struct.passwd* %15, null
br i1 %16, label %27, label %17
17: ; preds = %13
%18 = bitcast [0 x i8*]* %3 to i8*
%19 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i64 0, i32 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = getelementptr inbounds [0 x i8*], [0 x i8*]* %3, i64 0, i64 0
%26 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i32 %20, i8* %22, i8* %24, i32* null, i8** %25)
br label %27
27: ; preds = %17, %13, %5
%28 = phi i32 [ 1, %5 ], [ 0, %17 ], [ 1, %13 ]
ret i32 %28
}