#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 /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int submitr(char *, int, char *, char *, char *, char *, char *);
int driver_post(char *userid, char *result, int autograded, char *status_msg) {
  int status;
  if (autograded) {
    printf("\nAUTORESULT_STRING=%s\n", result);
    strcpy(status_msg, "OK");
    return 0;
  }
  if (userid && strcmp(userid, "")) {
    status = submitr("unofficial.fish.ics.cs.cmu.edu", 80, "15213-f11", userid,
                     "tshlab", result, status_msg);
    return status;
  }
  strcpy(status_msg, "OK");
  return 0;
}


x86 assembly (clang, -O0):
<driver_post>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     118d <driver_post+0x4d>
mov    -0x18(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <driver_post+0xc6>
cmpq   $0x0,-0x10(%rbp)
je     11ef <driver_post+0xaf>
mov    -0x10(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11ef <driver_post+0xaf>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r9
mov    -0x28(%rbp),%rax
lea    0xe55(%rip),%rdi
mov    $0x50,%esi
lea    0xe68(%rip),%rdx
lea    0xe6b(%rip),%r8
mov    %rax,(%rsp)
call   1050 <submitr@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1206 <driver_post+0xc6>
mov    -0x28(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<driver_post>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
mov    %rsi,%r14
test   %edx,%edx
je     117d <driver_post+0x3d>
lea    0xea6(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rdi,%r15
test   %rdi,%rdi
je     1162 <driver_post+0x22>
lea    0xe8a(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1162 <driver_post+0x22>
mov    %rbx,(%rsp)
lea    0xe76(%rip),%rdi
lea    0xe8e(%rip),%rdx
lea    0xe91(%rip),%r8
mov    $0x50,%esi
mov    %r15,%rcx
mov    %r14,%r9
call   1050 <submitr@plt>
jmp    1173 <driver_post+0x33>

LLVM IR (-O0):
@.str = [23 x i8] c"\0AAUTORESULT_STRING=%s\0A\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [31 x i8] c"unofficial.fish.ics.cs.cmu.edu\00"
@.str.4 = [10 x i8] c"15213-f11\00"
@.str.5 = [7 x i8] c"tshlab\00"
define i32 @driver_post(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%11 = load i32, i32* %8
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = load i8*, i8** %7
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %9
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %34
18: ; preds = %4
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i8*, i8** %6
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = load i8*, i8** %7
%28 = load i8*, i8** %9
%29 = call i32 @submitr(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 80, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %27, i8* %28)
store i32 %29, i32* %10
%30 = load i32, i32* %10
store i32 %30, i32* %5
br label %34
31: ; preds = %21, %18
%32 = load i8*, i8** %9
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %34
34: ; preds = %31, %25, %13
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0AAUTORESULT_STRING=%s\0A\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [31 x i8] c"unofficial.fish.ics.cs.cmu.edu\00"
@.str.4 = [10 x i8] c"15213-f11\00"
@.str.5 = [7 x i8] c"tshlab\00"
define i32 @driver_post(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = icmp eq i32 %2, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
9: ; preds = %4
%10 = icmp eq i8* %0, null
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @submitr(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 80, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* %3)
br label %18
16: ; preds = %11, %9
%17 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %6
%19 = phi i32 [ 0, %6 ], [ %15, %14 ], [ 0, %16 ]
ret i32 %19
}