#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 stat {
  int dummy;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ show_file(char const *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, char const *);
int stat(char *, struct stat *);
scalar_t__ strcmp(char *, char *);
char *tracecmd_get_tracing_file(char const *);
int /*<<< orphan*/ tracecmd_put_tracing_file(char *);
int /*<<< orphan*/ usage(char **);
int /*<<< orphan*/ write_file(char const *, char *);
void trace_snapshot(int argc, char **argv) {
  const char *buffer = NULL;
  const char *file = "snapshot";
  struct stat st;
  char *name;
  char cpu_path[128];
  int take_snap = 0;
  int reset_snap = 0;
  int free_snap = 0;
  int cpu = -1;
  int ret;
  int c;
  if (argc < 2)
    usage(argv);
  if (strcmp(argv[1], "snapshot") != 0)
    usage(argv);
  while ((c = getopt(argc - 1, argv + 1, "srfB:c:")) >= 0) {
    switch (c) {
    case 'h':
      usage(argv);
      break;
    case 's':
      take_snap = 1;
      if (free_snap)
        die("can't take snapshot and free it at the same time");
      break;
    case 'f':
      free_snap = 1;
      if (take_snap)
        die("can't take snapshot and free it at the same time");
      break;
    case 'r':
      reset_snap = 1;
      break;
    case 'B':
      if (buffer)
        die("Can only do one buffer at a time");
      buffer = optarg;
      break;
    case 'c':
      if (cpu >= 0)
        die("Can only do one CPU (or all) at a time");
      cpu = atoi(optarg);
      break;
    default:
      usage(argv);
    }
  }
  if (cpu >= 0) {
    snprintf(cpu_path, 128, "per_cpu/cpu%d/%s", cpu, file);
    file = cpu_path;
  }
  name = tracecmd_get_tracing_file(file);
  ret = stat(name, &st);
  if (ret < 0)
    die("Snapshot feature is not supported by this kernel");
  tracecmd_put_tracing_file(name);
  if (!reset_snap && !take_snap && !free_snap) {
    show_file(file);
    exit(0);
  }
  if (reset_snap)
    write_file(file, "2");
  if (free_snap)
    write_file(file, "0");
  if (take_snap)
    write_file(file, "1");
}


x86 assembly (clang, -O0):
<trace_snapshot>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xee7(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
movl   $0x0,-0xbc(%rbp)
movl   $0xffffffff,-0xc0(%rbp)
ff ff ff
cmpl   $0x2,-0x4(%rbp)
jge    1220 <trace_snapshot+0x60>
mov    -0x10(%rbp),%rdi
call   10a0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe99(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1247 <trace_snapshot+0x87>
mov    -0x10(%rbp),%rdi
call   10a0 <usage@plt>
jmp    124c <trace_snapshot+0x8c>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
lea    0xe70(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0xc8(%rbp)
cmp    $0x0,%eax
jl     137f <trace_snapshot+0x1bf>
mov    -0xc8(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0xd0(%rbp)
sub    $0x31,%eax
ja     1371 <trace_snapshot+0x1b1>
mov    -0xd0(%rbp),%rax
lea    0xd62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   10a0 <usage@plt>
jmp    137a <trace_snapshot+0x1ba>
movl   $0x1,-0xb4(%rbp)
cmpl   $0x0,-0xbc(%rbp)
je     12d8 <trace_snapshot+0x118>
lea    0xe06(%rip),%rdi
call   10b0 <die@plt>
jmp    137a <trace_snapshot+0x1ba>
movl   $0x1,-0xbc(%rbp)
cmpl   $0x0,-0xb4(%rbp)
je     1300 <trace_snapshot+0x140>
lea    0xdde(%rip),%rdi
call   10b0 <die@plt>
jmp    137a <trace_snapshot+0x1ba>
movl   $0x1,-0xb8(%rbp)
jmp    137a <trace_snapshot+0x1ba>
cmpq   $0x0,-0x18(%rbp)
je     132b <trace_snapshot+0x16b>
lea    0xde4(%rip),%rdi
call   10b0 <die@plt>
mov    0x2cc6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    137a <trace_snapshot+0x1ba>
cmpl   $0x0,-0xc0(%rbp)
jl     1357 <trace_snapshot+0x197>
lea    0xdd9(%rip),%rdi
call   10b0 <die@plt>
mov    0x2c9a(%rip),%rax
mov    (%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0xc0(%rbp)
jmp    137a <trace_snapshot+0x1ba>
mov    -0x10(%rbp),%rdi
call   10a0 <usage@plt>
jmp    124c <trace_snapshot+0x8c>
cmpl   $0x0,-0xc0(%rbp)
jl     13b9 <trace_snapshot+0x1f9>
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    $0x80,%esi
lea    0xda9(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <tracecmd_get_tracing_file@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0xc4(%rbp)
cmpl   $0x0,-0xc4(%rbp)
jge    13f2 <trace_snapshot+0x232>
lea    0xd76(%rip),%rdi
call   10b0 <die@plt>
mov    -0x30(%rbp),%rdi
call   1030 <tracecmd_put_tracing_file@plt>
cmpl   $0x0,-0xb8(%rbp)
jne    1432 <trace_snapshot+0x272>
cmpl   $0x0,-0xb4(%rbp)
jne    1432 <trace_snapshot+0x272>
cmpl   $0x0,-0xbc(%rbp)
jne    1432 <trace_snapshot+0x272>
mov    -0x20(%rbp),%rdi
call   1060 <show_file@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0xb8(%rbp)
je     144f <trace_snapshot+0x28f>
mov    -0x20(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   1040 <write_file@plt>
cmpl   $0x0,-0xbc(%rbp)
je     146c <trace_snapshot+0x2ac>
mov    -0x20(%rbp),%rdi
lea    0xd2f(%rip),%rsi
call   1040 <write_file@plt>
cmpl   $0x0,-0xb4(%rbp)
je     1489 <trace_snapshot+0x2c9>
mov    -0x20(%rbp),%rdi
lea    0xd14(%rip),%rsi
call   1040 <write_file@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace_snapshot>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x1,%edi
jg     11e3 <trace_snapshot+0x23>
mov    %r14,%rdi
call   10a0 <usage@plt>
lea    0x8(%r14),%rbx
mov    0x8(%r14),%rdi
lea    0xed6(%rip),%r15
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1207 <trace_snapshot+0x47>
mov    %r14,%rdi
call   10a0 <usage@plt>
add    $0xffffffff,%ebp
lea    0xec0(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   10c0 <getopt@plt>
test   %eax,%eax
js     136f <trace_snapshot+0x1af>
mov    %r14,0x20(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x18(%rsp)
movl   $0xffffffff,0x14(%rsp)
ff
lea    0xe93(%rip),%r13
lea    0xdbb(%rip),%r15
movl   $0x0,0xc(%rsp)
xor    %r14d,%r14d
movl   $0x0,0x10(%rsp)
jmp    1282 <trace_snapshot+0xc2>
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rdi
call   10a0 <usage@plt>
mov    %r12d,%r14d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10c0 <getopt@plt>
test   %eax,%eax
js     1345 <trace_snapshot+0x185>
mov    %r14d,%r12d
add    $0xffffffbe,%eax
cmp    $0x31,%eax
ja     1260 <trace_snapshot+0xa0>
mov    $0x1,%r14d
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
cmpq   $0x0,0x18(%rsp)
je     12b0 <trace_snapshot+0xf0>
lea    0xe5f(%rip),%rdi
call   10b0 <die@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
jmp    126a <trace_snapshot+0xaa>
cmpl   $0x0,0x14(%rsp)
js     12d4 <trace_snapshot+0x114>
lea    0xe5c(%rip),%rdi
call   10b0 <die@plt>
mov    0x2d1d(%rip),%rax
mov    (%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,0x14(%rsp)
jmp    126a <trace_snapshot+0xaa>
cmpl   $0x0,0x10(%rsp)
jne    130c <trace_snapshot+0x14c>
movl   $0x1,0xc(%rsp)
movl   $0x0,0x10(%rsp)
jmp    126a <trace_snapshot+0xaa>
cmpl   $0x0,0xc(%rsp)
je     1330 <trace_snapshot+0x170>
lea    0xdc6(%rip),%rdi
call   10b0 <die@plt>
movl   $0x1,0x10(%rsp)
mov    %r12d,%r14d
movl   $0x1,0xc(%rsp)
jmp    126d <trace_snapshot+0xad>
movl   $0x0,0xc(%rsp)
movl   $0x1,0x10(%rsp)
jmp    126a <trace_snapshot+0xaa>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
js     1379 <trace_snapshot+0x1b9>
lea    0x30(%rsp),%r15
lea    0xdf9(%rip),%rdx
lea    0xd68(%rip),%r8
mov    %r15,%rdi
mov    $0x80,%esi
call   1050 <snprintf@plt>
jmp    1380 <trace_snapshot+0x1c0>
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %r12d,%r12d
jmp    1389 <trace_snapshot+0x1c9>
lea    0xd48(%rip),%r15
mov    0x10(%rsp),%r12d
mov    0xc(%rsp),%ebp
mov    %r15,%rdi
call   1070 <tracecmd_get_tracing_file@plt>
mov    %rax,%rbx
lea    0x28(%rsp),%rsi
mov    %rax,%rdi
call   1090 <stat@plt>
test   %eax,%eax
jns    13b1 <trace_snapshot+0x1f1>
lea    0xdb7(%rip),%rdi
call   10b0 <die@plt>
mov    %rbx,%rdi
call   1030 <tracecmd_put_tracing_file@plt>
test   %r14d,%r14d
jne    13c7 <trace_snapshot+0x207>
test   %r12d,%r12d
jne    13c7 <trace_snapshot+0x207>
test   %ebp,%ebp
je     1414 <trace_snapshot+0x254>
test   %r14d,%r14d
je     13db <trace_snapshot+0x21b>
lea    0xdc1(%rip),%rsi
mov    %r15,%rdi
call   1040 <write_file@plt>
test   %ebp,%ebp
je     13ee <trace_snapshot+0x22e>
lea    0xdb0(%rip),%rsi
mov    %r15,%rdi
call   1040 <write_file@plt>
test   %r12d,%r12d
je     1402 <trace_snapshot+0x242>
lea    0xd9e(%rip),%rsi
mov    %r15,%rdi
call   1040 <write_file@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
call   1060 <show_file@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [9 x i8] c"snapshot\00"
@.str.1 = [8 x i8] c"srfB:c:\00"
@.str.2 = [49 x i8] c"can't take snapshot and free it at the same time\00"
@.str.3 = [33 x i8] c"Can only do one buffer at a time\00"
@optarg = global i8* null
@.str.4 = [39 x i8] c"Can only do one CPU (or all) at a time\00"
@.str.5 = [17 x i8] c"per_cpu/cpu%d/%s\00"
@.str.6 = [49 x i8] c"Snapshot feature is not supported by this kernel\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"1\00"
define void @trace_snapshot(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.stat
%8 = alloca i8*
%9 = alloca [128 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* null, i8** %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 -1, i32* %13
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i8**, i8*** %4
%20 = call i32 @usage(i8** %19)
br label %21
21: ; preds = %18, %2
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = load i8**, i8*** %4
%29 = call i32 @usage(i8** %28)
br label %30
30: ; preds = %27, %21
br label %31
31: ; preds = %74, %30
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = call i32 @getopt(i32 %33, i8** %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 %36, i32* %15
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %75
38: ; preds = %31
%39 = load i32, i32* %15
switch i32 %39, label %71 [
i32 104, label %40
i32 115, label %43
i32 102, label %49
i32 114, label %55
i32 66, label %56
i32 99, label %63
]
40: ; preds = %38
%41 = load i8**, i8*** %4
%42 = call i32 @usage(i8** %41)
br label %74
43: ; preds = %38
store i32 1, i32* %10
%44 = load i32, i32* %12
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
br label %74
49: ; preds = %38
store i32 1, i32* %12
%50 = load i32, i32* %10
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %52, %49
br label %74
55: ; preds = %38
store i32 1, i32* %11
br label %74
56: ; preds = %38
%57 = load i8*, i8** %5
%58 = icmp ne i8* %57, null
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 @die(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
%62 = load i8*, i8** @optarg
store i8* %62, i8** %5
br label %74
63: ; preds = %38
%64 = load i32, i32* %13
%65 = icmp sge i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @die(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
br label %68
68: ; preds = %66, %63
%69 = load i8*, i8** @optarg
%70 = call i32 @atoi(i8* %69)
store i32 %70, i32* %13
br label %74
71: ; preds = %38
%72 = load i8**, i8*** %4
%73 = call i32 @usage(i8** %72)
br label %74
74: ; preds = %71, %68, %61, %55, %54, %48, %40
br label %31
75: ; preds = %31
%76 = load i32, i32* %13
%77 = icmp sge i32 %76, 0
br i1 %77, label %78, label %84
78: ; preds = %75
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%80 = load i32, i32* %13
%81 = load i8*, i8** %6
%82 = call i32 @snprintf(i8* %79, i32 128, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %80, i8* %81)
%83 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
store i8* %83, i8** %6
br label %84
84: ; preds = %78, %75
%85 = load i8*, i8** %6
%86 = call i8* @tracecmd_get_tracing_file(i8* %85)
store i8* %86, i8** %8
%87 = load i8*, i8** %8
%88 = call i32 @stat(i8* %87, %struct.stat* %7)
store i32 %88, i32* %14
%89 = load i32, i32* %14
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %84
%92 = call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
br label %93
93: ; preds = %91, %84
%94 = load i8*, i8** %8
%95 = call i32 @tracecmd_put_tracing_file(i8* %94)
%96 = load i32, i32* %11
%97 = icmp ne i32 %96, 0
br i1 %97, label %108, label %98
98: ; preds = %93
%99 = load i32, i32* %10
%100 = icmp ne i32 %99, 0
br i1 %100, label %108, label %101
101: ; preds = %98
%102 = load i32, i32* %12
%103 = icmp ne i32 %102, 0
br i1 %103, label %108, label %104
104: ; preds = %101
%105 = load i8*, i8** %6
%106 = call i32 @show_file(i8* %105)
%107 = call i32 @exit(i32 0)
unreachable
108: ; preds = %101, %98, %93
%109 = load i32, i32* %11
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %114
111: ; preds = %108
%112 = load i8*, i8** %6
%113 = call i32 @write_file(i8* %112, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %114
114: ; preds = %111, %108
%115 = load i32, i32* %12
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %120
117: ; preds = %114
%118 = load i8*, i8** %6
%119 = call i32 @write_file(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %120
120: ; preds = %117, %114
%121 = load i32, i32* %10
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %120
%124 = load i8*, i8** %6
%125 = call i32 @write_file(i8* %124, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %126
126: ; preds = %123, %120
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [9 x i8] c"snapshot\00"
@.str.1 = [8 x i8] c"srfB:c:\00"
@.str.2 = [49 x i8] c"can't take snapshot and free it at the same time\00"
@.str.3 = [33 x i8] c"Can only do one buffer at a time\00"
@optarg = global i8* null
@.str.4 = [39 x i8] c"Can only do one CPU (or all) at a time\00"
@.str.5 = [17 x i8] c"per_cpu/cpu%d/%s\00"
@.str.6 = [49 x i8] c"Snapshot feature is not supported by this kernel\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"1\00"
define void @trace_snapshot(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = alloca [128 x i8]
%5 = bitcast %struct.stat* %3 to i8*
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @usage(i8** %1)
br label %10
10: ; preds = %8, %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 @usage(i8** %1)
br label %17
17: ; preds = %15, %10
%18 = add nsw i32 %0, -1
%19 = tail call i32 @getopt(i32 %18, i8** %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp sgt i32 %19, -1
br i1 %20, label %21, label %65
21: ; preds = %17, %53
%22 = phi i32 [ %59, %53 ], [ %19, %17 ]
%23 = phi i8* [ %58, %53 ], [ null, %17 ]
%24 = phi i32 [ %57, %53 ], [ -1, %17 ]
%25 = phi i32 [ %56, %53 ], [ 0, %17 ]
%26 = phi i32 [ %55, %53 ], [ 0, %17 ]
%27 = phi i32 [ %54, %53 ], [ 0, %17 ]
switch i32 %22, label %51 [
i32 104, label %28
i32 115, label %30
i32 102, label %34
i32 114, label %53
i32 66, label %38
i32 99, label %44
]
28: ; preds = %21
%29 = tail call i32 @usage(i8** %1)
br label %53
30: ; preds = %21
%31 = icmp eq i32 %25, 0
br i1 %31, label %53, label %32
32: ; preds = %30
%33 = tail call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %53
34: ; preds = %21
%35 = icmp eq i32 %27, 0
br i1 %35, label %53, label %36
36: ; preds = %34
%37 = tail call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
br label %53
38: ; preds = %21
%39 = icmp eq i8* %23, null
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = tail call i32 @die(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = load i8*, i8** @optarg
br label %53
44: ; preds = %21
%45 = icmp sgt i32 %24, -1
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = tail call i32 @die(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
%49 = load i8*, i8** @optarg
%50 = tail call i32 @atoi(i8* %49)
br label %53
51: ; preds = %21
%52 = tail call i32 @usage(i8** %1)
br label %53
53: ; preds = %21, %34, %36, %30, %32, %51, %48, %42, %28
%54 = phi i32 [ %27, %51 ], [ %27, %48 ], [ %27, %42 ], [ 1, %36 ], [ 0, %34 ], [ 1, %32 ], [ 1, %30 ], [ %27, %28 ], [ %27, %21 ]
%55 = phi i32 [ %26, %51 ], [ %26, %48 ], [ %26, %42 ], [ %26, %36 ], [ %26, %34 ], [ %26, %32 ], [ %26, %30 ], [ %26, %28 ], [ 1, %21 ]
%56 = phi i32 [ %25, %51 ], [ %25, %48 ], [ %25, %42 ], [ 1, %36 ], [ 1, %34 ], [ 1, %32 ], [ 0, %30 ], [ %25, %28 ], [ %25, %21 ]
%57 = phi i32 [ %24, %51 ], [ %50, %48 ], [ %24, %42 ], [ %24, %36 ], [ %24, %34 ], [ %24, %32 ], [ %24, %30 ], [ %24, %28 ], [ %24, %21 ]
%58 = phi i8* [ %23, %51 ], [ %23, %48 ], [ %43, %42 ], [ %23, %36 ], [ %23, %34 ], [ %23, %32 ], [ %23, %30 ], [ %23, %28 ], [ %23, %21 ]
%59 = tail call i32 @getopt(i32 %18, i8** %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%60 = icmp sgt i32 %59, -1
br i1 %60, label %21, label %61
61: ; preds = %53
%62 = icmp sgt i32 %57, -1
br i1 %62, label %63, label %65
63: ; preds = %61
%64 = call i32 @snprintf(i8* %6, i32 128, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %65
65: ; preds = %17, %63, %61
%66 = phi i32 [ %56, %63 ], [ %56, %61 ], [ 0, %17 ]
%67 = phi i32 [ %55, %63 ], [ %55, %61 ], [ 0, %17 ]
%68 = phi i32 [ %54, %63 ], [ %54, %61 ], [ 0, %17 ]
%69 = phi i8* [ %6, %63 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %61 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %17 ]
%70 = call i8* @tracecmd_get_tracing_file(i8* %69)
%71 = call i32 @stat(i8* %70, %struct.stat* %3)
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %65
%74 = call i32 @die(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
br label %75
75: ; preds = %73, %65
%76 = call i32 @tracecmd_put_tracing_file(i8* %70)
%77 = icmp ne i32 %67, 0
%78 = icmp ne i32 %68, 0
%79 = select i1 %77, i1 true, i1 %78
%80 = icmp ne i32 %66, 0
%81 = select i1 %79, i1 true, i1 %80
br i1 %81, label %85, label %82
82: ; preds = %75
%83 = call i32 @show_file(i8* %69)
%84 = call i32 @exit(i32 0)
unreachable
85: ; preds = %75
br i1 %77, label %86, label %88
86: ; preds = %85
%87 = call i32 @write_file(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %88
88: ; preds = %86, %85
br i1 %80, label %89, label %91
89: ; preds = %88
%90 = call i32 @write_file(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %91
91: ; preds = %89, %88
br i1 %78, label %92, label %94
92: ; preds = %91
%93 = call i32 @write_file(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %94
94: ; preds = %92, %91
ret void
}