// File: /workspace/github_c_makefile_star2_O1/sos22[P]unexec/tests/environ.c
// Function: main
int main(int argc, char **argv) {
    char buf[] = "environXXXXXX";
    close(mkstemp(buf));
    struct new_environment env;
    int r = unexec(buf, &env);
    if (r < 0) err(1, "unexec");
    if (r == 1) {
        execl(buf, buf, "hello", NULL);
        err(1, "execl %s", buf); }
    assert(env.argc == 2);
    assert(!strcmp(env.argv[0], buf));
    assert(!strcmp(env.argv[1], "hello"));
    assert(argc == 1);
    assert(argv[1] == NULL);
    release_new_environment(&env);
    setenv("foobly", "moo", 1);
    setenv("wibble", "woo", 1);
    if (unlink(buf) < 0) err(1, "unlink");
    r = unexec(buf, &env);
    if (r < 0) err(1, "unexec");
    if (r == 1) {
        char * args[] = {"buf", NULL};
        char * environ[] = {"foobly=baroom", NULL};
        execve(buf, args, environ);
        err(1, "execve %s", buf); }
    assert(!strcmp(getenv("foobly"), "moo"));
    assert(!strcmp(getenv("wibble"), "woo"));
    assert(!strcmp(env.environ[0], "foobly=baroom"));
    assert(env.environ[1] == NULL);
    release_new_environment(&env);
    if (unlink(buf) < 0) err(1, "unlink");
    return 0; }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movl %edi, %r14d
movabsq $0x5858585858586e, %rax # imm = 0x5858585858586E
leaq -0x28(%rbp), %r15
movq %rax, 0x6(%r15)
movabsq $0x586e6f7269766e65, %rax # imm = 0x586E6F7269766E65
movq %rax, (%r15)
movq %r15, %rdi
callq 0x10b0
movl %eax, %edi
callq 0x1070
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x10d0
testl %eax, %eax
js 0x1390
cmpl $0x1, %eax
je 0x13ac
cmpl $0x2, -0x40(%rbp)
jne 0x13d2
movq -0x38(%rbp), %r15
movq (%r15), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1090
testl %eax, %eax
jne 0x13f1
movq 0x8(%r15), %rdi
leaq 0xda2(%rip), %rsi       # 0x2019
callq 0x1090
testl %eax, %eax
jne 0x1410
cmpl $0x1, %r14d
jne 0x142f
cmpq $0x0, 0x8(%rbx)
jne 0x144e
leaq -0x40(%rbp), %rdi
callq 0x10c0
leaq 0xe06(%rip), %rdi       # 0x20af
leaq 0xe06(%rip), %rsi       # 0x20b6
movl $0x1, %edx
callq 0x1050
leaq 0xdf9(%rip), %rdi       # 0x20ba
leaq 0xdf9(%rip), %rsi       # 0x20c1
movl $0x1, %edx
callq 0x1050
leaq -0x28(%rbp), %rdi
callq 0x1040
testl %eax, %eax
js 0x1399
leaq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x10d0
testl %eax, %eax
js 0x1390
cmpl $0x1, %eax
je 0x146d
leaq 0xda7(%rip), %rdi       # 0x20af
callq 0x1030
leaq 0xda2(%rip), %rsi       # 0x20b6
movq %rax, %rdi
callq 0x1090
testl %eax, %eax
jne 0x14ab
leaq 0xd8f(%rip), %rdi       # 0x20ba
callq 0x1030
leaq 0xd8a(%rip), %rsi       # 0x20c1
movq %rax, %rdi
callq 0x1090
testl %eax, %eax
jne 0x14ca
movq -0x30(%rbp), %rbx
movq (%rbx), %rdi
leaq 0xd7b(%rip), %rsi       # 0x20d0
callq 0x1090
testl %eax, %eax
jne 0x14e9
cmpq $0x0, 0x8(%rbx)
jne 0x1508
leaq -0x40(%rbp), %rdi
callq 0x10c0
leaq -0x28(%rbp), %rdi
callq 0x1040
testl %eax, %eax
js 0x1399
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc7b(%rip), %rsi       # 0x2012
jmp 0x13a0
leaq 0xd25(%rip), %rsi       # 0x20c5
movl $0x1, %edi
xorl %eax, %eax
callq 0x10a0
leaq 0xc66(%rip), %rdx       # 0x2019
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x10e0
leaq 0xc52(%rip), %rsi       # 0x201f
jmp 0x149c
leaq 0xc4f(%rip), %rdi       # 0x2028
leaq 0xc56(%rip), %rsi       # 0x2036
leaq 0xc5f(%rip), %rcx       # 0x2046
movl $0x13, %edx
callq 0x1060
leaq 0xc65(%rip), %rdi       # 0x205d
leaq 0xc37(%rip), %rsi       # 0x2036
leaq 0xc40(%rip), %rcx       # 0x2046
movl $0x14, %edx
callq 0x1060
leaq 0xc60(%rip), %rdi       # 0x2077
leaq 0xc18(%rip), %rsi       # 0x2036
leaq 0xc21(%rip), %rcx       # 0x2046
movl $0x15, %edx
callq 0x1060
leaq 0xc5f(%rip), %rdi       # 0x2095
leaq 0xbf9(%rip), %rsi       # 0x2036
leaq 0xc02(%rip), %rcx       # 0x2046
movl $0x16, %edx
callq 0x1060
leaq 0xc4a(%rip), %rdi       # 0x209f
leaq 0xbda(%rip), %rsi       # 0x2036
leaq 0xbe3(%rip), %rcx       # 0x2046
movl $0x17, %edx
callq 0x1060
movaps 0x293c(%rip), %xmm0     # 0x3db0
leaq -0x60(%rbp), %rsi
movaps %xmm0, (%rsi)
movaps 0x293e(%rip), %xmm0     # 0x3dc0
leaq -0x50(%rbp), %rdx
movaps %xmm0, (%rdx)
leaq -0x28(%rbp), %rbx
movq %rbx, %rdi
callq 0x1080
leaq 0xc42(%rip), %rsi       # 0x20de
movl $0x1, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10a0
leaq 0xc36(%rip), %rdi       # 0x20e8
leaq 0xb7d(%rip), %rsi       # 0x2036
leaq 0xb86(%rip), %rcx       # 0x2046
movl $0x23, %edx
callq 0x1060
leaq 0xc38(%rip), %rdi       # 0x2109
leaq 0xb5e(%rip), %rsi       # 0x2036
leaq 0xb67(%rip), %rcx       # 0x2046
movl $0x24, %edx
callq 0x1060
leaq 0xc3a(%rip), %rdi       # 0x212a
leaq 0xb3f(%rip), %rsi       # 0x2036
leaq 0xb48(%rip), %rcx       # 0x2046
movl $0x25, %edx
callq 0x1060
leaq 0xc44(%rip), %rdi       # 0x2153
leaq 0xb20(%rip), %rsi       # 0x2036
leaq 0xb29(%rip), %rcx       # 0x2046
movl $0x26, %edx
callq 0x1060