#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*/ AF_INET;
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ AF_NETLINK;
int /*<<< orphan*/ AF_PACKET;
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ ETH_P_ARP;
int MS_NOSUID;
int MS_STRICTATIME;
int /*<<< orphan*/ NETLINK_ROUTE;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ mkdir(char *, int);
scalar_t__ mount(char *, char *, char *, int, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: test [sleep|socket|mkdir|mount]\n");
    return 1;
  }
  if (strcmp(argv[1], "sleep") == 0) {
    printf("before sleep\n");
    sleep(1);
    printf("after sleep\n");
  } else if (strcmp(argv[1], "socket") == 0) {
    int sock;
    printf("testing socket AF_INET\n");
    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
      perror("socket");
    } else
      close(sock);
    printf("testing socket AF_INET6\n");
    if ((sock = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
      perror("socket");
    } else
      close(sock);
    printf("testing socket AF_NETLINK\n");
    if ((sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) < 0) {
      perror("socket");
    } else
      close(sock);
    printf("testing socket AF_UNIX\n");
    if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
      perror("socket");
    } else
      close(sock);
    printf("testing socket AF_PACKETX\n");
    if ((sock = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ARP))) < 0) {
      perror("socket");
    } else
      close(sock);
    printf("after socket\n");
  } else if (strcmp(argv[1], "mkdir") == 0) {
    printf("before mkdir\n");
    mkdir("tmp", 0777);
    printf("after mkdir\n");
  } else if (strcmp(argv[1], "mount") == 0) {
    printf("before mount\n");
    if (mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_STRICTATIME,
              "mode=755,gid=0") < 0) {
      perror("mount");
    }
    printf("after mount\n");
  } else {
    fprintf(stderr, "Error: invalid argument\n");
    return 1;
  }
  return 0;
}


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)
je     11d8 <main+0x38>
lea    0xe39(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e2 <main+0x342>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe41(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    121d <main+0x7d>
lea    0xe31(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
lea    0xe29(%rip),%rdi
call   1060 <printf@plt>
jmp    14db <main+0x33b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1d(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    13df <main+0x23f>
lea    0xe0e(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    0x2d39(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    127d <main+0xdd>
lea    0xdd6(%rip),%rdi
call   10a0 <perror@plt>
jmp    1285 <main+0xe5>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xddc(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12c7 <main+0x127>
lea    0xd8c(%rip),%rdi
call   10a0 <perror@plt>
jmp    12cf <main+0x12f>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xdab(%rip),%rdi
call   1060 <printf@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
mov    0x2c84(%rip),%rax
mov    (%rax),%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1318 <main+0x178>
lea    0xd3b(%rip),%rdi
call   10a0 <perror@plt>
jmp    1320 <main+0x180>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xd75(%rip),%rdi
call   1060 <printf@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    0x2c54(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1362 <main+0x1c2>
lea    0xcf1(%rip),%rdi
call   10a0 <perror@plt>
jmp    136a <main+0x1ca>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xd43(%rip),%rdi
call   1060 <printf@plt>
mov    0x2c23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2c37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   1050 <htons@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %eax,%edx
call   10c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    13c6 <main+0x226>
lea    0xc8d(%rip),%rdi
call   10a0 <perror@plt>
jmp    13ce <main+0x22e>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
lea    0xcfa(%rip),%rdi
call   1060 <printf@plt>
jmp    14d6 <main+0x336>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcef(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    142b <main+0x28b>
lea    0xcdf(%rip),%rdi
call   1060 <printf@plt>
lea    0xd09(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xcd0(%rip),%rdi
call   1060 <printf@plt>
jmp    14d1 <main+0x331>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcc4(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14ab <main+0x30b>
lea    0xcb4(%rip),%rdi
call   1060 <printf@plt>
mov    0x2b84(%rip),%rax
mov    (%rax),%ecx
mov    0x2b83(%rip),%rax
or     (%rax),%ecx
lea    0xca4(%rip),%rdx
lea    0xca3(%rip),%rsi
lea    0xca1(%rip),%r8
mov    %rdx,%rdi
call   1040 <mount@plt>
cmp    $0x0,%rax
jge    149a <main+0x2fa>
lea    0xc69(%rip),%rdi
call   10a0 <perror@plt>
lea    0xc8b(%rip),%rdi
call   1060 <printf@plt>
jmp    14cc <main+0x32c>
mov    0x2ae6(%rip),%rax
mov    (%rax),%edi
lea    0xc7e(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e2 <main+0x342>
jmp    14d1 <main+0x331>
jmp    14d6 <main+0x336>
jmp    14db <main+0x33b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1222 <main+0x82>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xf3d(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1238 <main+0x98>
mov    0x8(%rbx),%rdi
lea    0xf1a(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     125a <main+0xba>
mov    0x8(%rbx),%rdi
lea    0xe6f(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1372 <main+0x1d2>
mov    0x8(%rbx),%rdi
lea    0xe3d(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1398 <main+0x1f8>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
call   1090 <fprintf@plt>
jmp    122e <main+0x8e>
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    13e6 <main+0x246>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
lea    0xea4(%rip),%rdi
jmp    13df <main+0x23f>
lea    0xe04(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    0x2d1a(%rip),%rbx
mov    (%rbx),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
test   %eax,%eax
js     13ed <main+0x24d>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xde7(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
test   %eax,%eax
js     13fe <main+0x25e>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xdd2(%rip),%rdi
call   1040 <puts@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
mov    0x2cf9(%rip),%rax
mov    (%rax),%esi
mov    0x2c98(%rip),%rax
mov    (%rax),%edx
call   10c0 <socket@plt>
test   %eax,%eax
js     140f <main+0x26f>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
test   %eax,%eax
js     1420 <main+0x280>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xd9b(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%ebx
mov    0x2c81(%rip),%rax
mov    (%rax),%ebp
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
call   1060 <htons@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   10c0 <socket@plt>
test   %eax,%eax
js     1431 <main+0x291>
mov    %eax,%edi
call   1070 <close@plt>
lea    0xd6f(%rip),%rdi
jmp    13df <main+0x23f>
lea    0xcd3(%rip),%rdi
call   1040 <puts@plt>
lea    0xc82(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
lea    0xcc3(%rip),%rdi
jmp    13df <main+0x23f>
lea    0xc94(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c35(%rip),%rax
mov    0x2c36(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
lea    0xc49(%rip),%rsi
lea    0xc3c(%rip),%rdi
lea    0xc40(%rip),%r8
mov    %rdi,%rdx
call   1050 <mount@plt>
test   %rax,%rax
js     1442 <main+0x2a2>
lea    0xc61(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xcf1(%rip),%rdi
call   10a0 <perror@plt>
jmp    128e <main+0xee>
lea    0xce0(%rip),%rdi
call   10a0 <perror@plt>
jmp    12bb <main+0x11b>
lea    0xccf(%rip),%rdi
call   10a0 <perror@plt>
jmp    12f6 <main+0x156>
lea    0xcbe(%rip),%rdi
call   10a0 <perror@plt>
jmp    1323 <main+0x183>
lea    0xcad(%rip),%rdi
call   10a0 <perror@plt>
jmp    1369 <main+0x1c9>
lea    0xbf1(%rip),%rdi
call   10a0 <perror@plt>
jmp    13d8 <main+0x238>

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: test [sleep|socket|mkdir|mount]\0A\00"
@.str.1 = [6 x i8] c"sleep\00"
@.str.2 = [14 x i8] c"before sleep\0A\00"
@.str.3 = [13 x i8] c"after sleep\0A\00"
@.str.4 = [7 x i8] c"socket\00"
@.str.5 = [24 x i8] c"testing socket AF_INET\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.6 = [25 x i8] c"testing socket AF_INET6\0A\00"
@AF_INET6 = global i32 0
@.str.7 = [27 x i8] c"testing socket AF_NETLINK\0A\00"
@AF_NETLINK = global i32 0
@SOCK_RAW = global i32 0
@NETLINK_ROUTE = global i32 0
@.str.8 = [24 x i8] c"testing socket AF_UNIX\0A\00"
@AF_UNIX = global i32 0
@.str.9 = [27 x i8] c"testing socket AF_PACKETX\0A\00"
@AF_PACKET = global i32 0
@SOCK_DGRAM = global i32 0
@ETH_P_ARP = global i32 0
@.str.10 = [14 x i8] c"after socket\0A\00"
@.str.11 = [6 x i8] c"mkdir\00"
@.str.12 = [14 x i8] c"before mkdir\0A\00"
@.str.13 = [4 x i8] c"tmp\00"
@.str.14 = [13 x i8] c"after mkdir\0A\00"
@.str.15 = [6 x i8] c"mount\00"
@.str.16 = [14 x i8] c"before mount\0A\00"
@.str.17 = [6 x i8] c"tmpfs\00"
@.str.18 = [5 x i8] c"/tmp\00"
@MS_NOSUID = global i32 0
@MS_STRICTATIME = global i32 0
@.str.19 = [15 x i8] c"mode=755,gid=0\00"
@.str.20 = [13 x i8] c"after mount\0A\00"
@stderr = global i32 0
@.str.21 = [25 x i8] c"Error: invalid argument\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %121
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @sleep(i32 1)
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %120
21: ; preds = %11
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %87
27: ; preds = %21
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%29 = load i32, i32* @AF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = call i32 @socket(i32 %29, i32 %30, i32 0)
store i32 %31, i32* %6
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %38
35: ; preds = %27
%36 = load i32, i32* %6
%37 = call i32 @close(i32 %36)
br label %38
38: ; preds = %35, %33
%39 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%40 = load i32, i32* @AF_INET6
%41 = load i32, i32* @SOCK_STREAM
%42 = call i32 @socket(i32 %40, i32 %41, i32 0)
store i32 %42, i32* %6
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %49
46: ; preds = %38
%47 = load i32, i32* %6
%48 = call i32 @close(i32 %47)
br label %49
49: ; preds = %46, %44
%50 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%51 = load i32, i32* @AF_NETLINK
%52 = load i32, i32* @SOCK_RAW
%53 = load i32, i32* @NETLINK_ROUTE
%54 = call i32 @socket(i32 %51, i32 %52, i32 %53)
store i32 %54, i32* %6
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %61
58: ; preds = %49
%59 = load i32, i32* %6
%60 = call i32 @close(i32 %59)
br label %61
61: ; preds = %58, %56
%62 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%63 = load i32, i32* @AF_UNIX
%64 = load i32, i32* @SOCK_STREAM
%65 = call i32 @socket(i32 %63, i32 %64, i32 0)
store i32 %65, i32* %6
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %61
%68 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %72
69: ; preds = %61
%70 = load i32, i32* %6
%71 = call i32 @close(i32 %70)
br label %72
72: ; preds = %69, %67
%73 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%74 = load i32, i32* @AF_PACKET
%75 = load i32, i32* @SOCK_DGRAM
%76 = load i32, i32* @ETH_P_ARP
%77 = call i32 @htons(i32 %76)
%78 = call i32 @socket(i32 %74, i32 %75, i32 %77)
store i32 %78, i32* %6
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %72
%81 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %85
82: ; preds = %72
%83 = load i32, i32* %6
%84 = call i32 @close(i32 %83)
br label %85
85: ; preds = %82, %80
%86 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %119
87: ; preds = %21
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 1
%90 = load i8*, i8** %89
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %87
%94 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%95 = call i32 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 511)
%96 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %118
97: ; preds = %87
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 1
%100 = load i8*, i8** %99
%101 = call i64 @strcmp(i8* %100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %114
103: ; preds = %97
%104 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0))
%105 = load i32, i32* @MS_NOSUID
%106 = load i32, i32* @MS_STRICTATIME
%107 = or i32 %105, %106
%108 = call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32 %107, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%109 = icmp slt i64 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %103
%111 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br label %112
112: ; preds = %110, %103
%113 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
br label %117
114: ; preds = %97
%115 = load i32, i32* @stderr
%116 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0))
store i32 1, i32* %3
br label %121
117: ; preds = %112
br label %118
118: ; preds = %117, %93
br label %119
119: ; preds = %118, %85
br label %120
120: ; preds = %119, %17
store i32 0, i32* %3
br label %121
121: ; preds = %120, %114, %9
%122 = load i32, i32* %3
ret i32 %122
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"sleep\00"
@.str.4 = [7 x i8] c"socket\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET6 = global i32 0
@AF_NETLINK = global i32 0
@SOCK_RAW = global i32 0
@NETLINK_ROUTE = global i32 0
@AF_UNIX = global i32 0
@AF_PACKET = global i32 0
@SOCK_DGRAM = global i32 0
@ETH_P_ARP = global i32 0
@.str.11 = [6 x i8] c"mkdir\00"
@.str.13 = [4 x i8] c"tmp\00"
@.str.15 = [6 x i8] c"mount\00"
@.str.17 = [6 x i8] c"tmpfs\00"
@.str.18 = [5 x i8] c"/tmp\00"
@MS_NOSUID = global i32 0
@MS_STRICTATIME = global i32 0
@.str.19 = [15 x i8] c"mode=755,gid=0\00"
@stderr = global i32 0
@.str.21 = [25 x i8] c"Error: invalid argument\0A\00"
@str = [13 x i8] c"before mount\00"
@str.22 = [12 x i8] c"after mount\00"
@str.23 = [13 x i8] c"before mkdir\00"
@str.24 = [12 x i8] c"after mkdir\00"
@str.25 = [23 x i8] c"testing socket AF_INET\00"
@str.26 = [24 x i8] c"testing socket AF_INET6\00"
@str.27 = [26 x i8] c"testing socket AF_NETLINK\00"
@str.28 = [23 x i8] c"testing socket AF_UNIX\00"
@str.29 = [26 x i8] c"testing socket AF_PACKETX\00"
@str.30 = [13 x i8] c"after socket\00"
@str.31 = [13 x i8] c"before sleep\00"
@str.32 = [12 x i8] c"after sleep\00"
@str.33 = [39 x i8] c"Usage: test [sleep|socket|mkdir|mount]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.33, i64 0, i64 0))
br label %100
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.31, i64 0, i64 0))
%13 = tail call i32 @sleep(i32 1)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.32, i64 0, i64 0))
br label %100
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %74
19: ; preds = %15
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.25, i64 0, i64 0))
%21 = load i32, i32* @AF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = tail call i32 @socket(i32 %21, i32 %22, i32 0)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %29
27: ; preds = %19
%28 = tail call i32 @close(i32 %23)
br label %29
29: ; preds = %27, %25
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.26, i64 0, i64 0))
%31 = load i32, i32* @AF_INET6
%32 = load i32, i32* @SOCK_STREAM
%33 = tail call i32 @socket(i32 %31, i32 %32, i32 0)
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %39
37: ; preds = %29
%38 = tail call i32 @close(i32 %33)
br label %39
39: ; preds = %37, %35
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.27, i64 0, i64 0))
%41 = load i32, i32* @AF_NETLINK
%42 = load i32, i32* @SOCK_RAW
%43 = load i32, i32* @NETLINK_ROUTE
%44 = tail call i32 @socket(i32 %41, i32 %42, i32 %43)
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %39
%47 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %50
48: ; preds = %39
%49 = tail call i32 @close(i32 %44)
br label %50
50: ; preds = %48, %46
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.28, i64 0, i64 0))
%52 = load i32, i32* @AF_UNIX
%53 = load i32, i32* @SOCK_STREAM
%54 = tail call i32 @socket(i32 %52, i32 %53, i32 0)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %50
%57 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %60
58: ; preds = %50
%59 = tail call i32 @close(i32 %54)
br label %60
60: ; preds = %58, %56
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.29, i64 0, i64 0))
%62 = load i32, i32* @AF_PACKET
%63 = load i32, i32* @SOCK_DGRAM
%64 = load i32, i32* @ETH_P_ARP
%65 = tail call i32 @htons(i32 %64)
%66 = tail call i32 @socket(i32 %62, i32 %63, i32 %65)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %60
%69 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %72
70: ; preds = %60
%71 = tail call i32 @close(i32 %66)
br label %72
72: ; preds = %70, %68
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.30, i64 0, i64 0))
br label %100
74: ; preds = %15
%75 = load i8*, i8** %7
%76 = tail call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %82
78: ; preds = %74
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.23, i64 0, i64 0))
%80 = tail call i32 @mkdir(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 511)
%81 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.24, i64 0, i64 0))
br label %100
82: ; preds = %74
%83 = load i8*, i8** %7
%84 = tail call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %97
86: ; preds = %82
%87 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%88 = load i32, i32* @MS_NOSUID
%89 = load i32, i32* @MS_STRICTATIME
%90 = or i32 %89, %88
%91 = tail call i64 @mount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32 %90, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %86
%94 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br label %95
95: ; preds = %93, %86
%96 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.22, i64 0, i64 0))
br label %100
97: ; preds = %82
%98 = load i32, i32* @stderr
%99 = tail call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0))
br label %100
100: ; preds = %11, %78, %95, %72, %97, %4
%101 = phi i32 [ 1, %4 ], [ 1, %97 ], [ 0, %72 ], [ 0, %95 ], [ 0, %78 ], [ 0, %11 ]
ret i32 %101
}