// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xdf7(%rip), %rax       # 0x2004
movq %rax, -0x1e(%rbp)
movl 0xdf5(%rip), %eax       # 0x200c
movl %eax, -0x16(%rbp)
movw 0xdef(%rip), %ax        # 0x2010
movw %ax, -0x12(%rbp)
leaq -0x1e(%rbp), %rdi
callq 0x10b0
movl %eax, %edi
callq 0x1070
leaq -0x1e(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x10d0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x125e
movl $0x1, %edi
leaq 0xdbb(%rip), %rsi       # 0x2012
movb $0x0, %al
callq 0x10a0
cmpl $0x1, -0x3c(%rbp)
jne 0x1295
leaq -0x1e(%rbp), %rdi
leaq -0x1e(%rbp), %rsi
leaq 0xda6(%rip), %rdx       # 0x2019
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x10e0
leaq -0x1e(%rbp), %rdx
movl $0x1, %edi
leaq 0xd91(%rip), %rsi       # 0x201f
movb $0x0, %al
callq 0x10a0
cmpl $0x2, -0x38(%rbp)
jne 0x129d
jmp 0x12bc
leaq 0xd84(%rip), %rdi       # 0x2028
leaq 0xd8b(%rip), %rsi       # 0x2036
movl $0x13, %edx
leaq 0xd8f(%rip), %rcx       # 0x2046
callq 0x1060
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq -0x1e(%rbp), %rsi
callq 0x1090
cmpl $0x0, %eax
jne 0x12d3
jmp 0x12f2
leaq 0xd83(%rip), %rdi       # 0x205d
leaq 0xd55(%rip), %rsi       # 0x2036
movl $0x14, %edx
leaq 0xd59(%rip), %rcx       # 0x2046
callq 0x1060
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xd18(%rip), %rsi       # 0x2019
callq 0x1090
cmpl $0x0, %eax
jne 0x130d
jmp 0x132c
leaq 0xd63(%rip), %rdi       # 0x2077
leaq 0xd1b(%rip), %rsi       # 0x2036
movl $0x15, %edx
leaq 0xd1f(%rip), %rcx       # 0x2046
callq 0x1060
cmpl $0x1, -0x8(%rbp)
jne 0x1334
jmp 0x1353
leaq 0xd5a(%rip), %rdi       # 0x2095
leaq 0xcf4(%rip), %rsi       # 0x2036
movl $0x16, %edx
leaq 0xcf8(%rip), %rcx       # 0x2046
callq 0x1060
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1360
jmp 0x137f
leaq 0xd38(%rip), %rdi       # 0x209f
leaq 0xcc8(%rip), %rsi       # 0x2036
movl $0x17, %edx
leaq 0xccc(%rip), %rcx       # 0x2046
callq 0x1060
leaq -0x38(%rbp), %rdi
callq 0x10c0
leaq 0xd20(%rip), %rdi       # 0x20af
leaq 0xd20(%rip), %rsi       # 0x20b6
movl $0x1, %edx
callq 0x1050
leaq 0xd13(%rip), %rdi       # 0x20ba
leaq 0xd13(%rip), %rsi       # 0x20c1
movl $0x1, %edx
callq 0x1050
leaq -0x1e(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
jge 0x13d9
movl $0x1, %edi
leaq 0xcf3(%rip), %rsi       # 0x20c5
movb $0x0, %al
callq 0x10a0
leaq -0x1e(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x10d0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x1402
movl $0x1, %edi
leaq 0xc17(%rip), %rsi       # 0x2012
movb $0x0, %al
callq 0x10a0
cmpl $0x1, -0x3c(%rbp)
jne 0x145c
movq 0x29a1(%rip), %rax      # 0x3db0
movq %rax, -0x50(%rbp)
movq 0x299e(%rip), %rax      # 0x3db8
movq %rax, -0x48(%rbp)
movq 0x299b(%rip), %rax      # 0x3dc0
movq %rax, -0x60(%rbp)
movq 0x2998(%rip), %rax      # 0x3dc8
movq %rax, -0x58(%rbp)
leaq -0x1e(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x1080
leaq -0x1e(%rbp), %rdx
movl $0x1, %edi
leaq 0xc89(%rip), %rsi       # 0x20de
movb $0x0, %al
callq 0x10a0
leaq 0xc4c(%rip), %rdi       # 0x20af
callq 0x1030
movq %rax, %rdi
leaq 0xc44(%rip), %rsi       # 0x20b6
callq 0x1090
cmpl $0x0, %eax
jne 0x147e
jmp 0x149d
leaq 0xc63(%rip), %rdi       # 0x20e8
leaq 0xbaa(%rip), %rsi       # 0x2036
movl $0x23, %edx
leaq 0xbae(%rip), %rcx       # 0x2046
callq 0x1060
leaq 0xc16(%rip), %rdi       # 0x20ba
callq 0x1030
movq %rax, %rdi
leaq 0xc0e(%rip), %rsi       # 0x20c1
callq 0x1090
cmpl $0x0, %eax
jne 0x14bf
jmp 0x14de
leaq 0xc43(%rip), %rdi       # 0x2109
leaq 0xb69(%rip), %rsi       # 0x2036
movl $0x24, %edx
leaq 0xb6d(%rip), %rcx       # 0x2046
callq 0x1060
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0xbe4(%rip), %rsi       # 0x20d0
callq 0x1090
cmpl $0x0, %eax
jne 0x14f8
jmp 0x1517
leaq 0xc2b(%rip), %rdi       # 0x212a
leaq 0xb30(%rip), %rsi       # 0x2036
movl $0x25, %edx
leaq 0xb34(%rip), %rcx       # 0x2046
callq 0x1060
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1524
jmp 0x1543
leaq 0xc28(%rip), %rdi       # 0x2153
leaq 0xb04(%rip), %rsi       # 0x2036
movl $0x26, %edx
leaq 0xb08(%rip), %rcx       # 0x2046
callq 0x1060
leaq -0x38(%rbp), %rdi
callq 0x10c0
leaq -0x1e(%rbp), %rdi
callq 0x1040
cmpl $0x0, %eax
jge 0x156d
movl $0x1, %edi
leaq 0xb5f(%rip), %rsi       # 0x20c5
movb $0x0, %al
callq 0x10a0
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq