#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 primary_session(char *);
int second_session(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc > 2) {
    if (strcmp(argv[1], "pppoe-session1") == 0)
      return primary_session(argv[2]);
    if (strcmp(argv[1], "pppoe-session2") == 0)
      return second_session(argv[2]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    11bb <main+0x8b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1183 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <primary_session@plt>
mov    %eax,-0x4(%rbp)
jmp    11c2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <main+0x86>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <second_session@plt>
mov    %eax,-0x4(%rbp)
jmp    11c2 <main+0x92>
jmp    11bb <main+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jl     1163 <main+0x33>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1167 <main+0x37>
mov    0x8(%rbx),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1171 <main+0x41>
xor    %eax,%eax
pop    %rbx
ret
mov    0x10(%rbx),%rdi
pop    %rbx
jmp    1040 <primary_session@plt>
mov    0x10(%rbx),%rdi
pop    %rbx
jmp    1050 <second_session@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"pppoe-session1\00"
@.str.1 = [15 x i8] c"pppoe-session2\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %31
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @primary_session(i8* %17)
store i32 %18, i32* %3
br label %32
19: ; preds = %8
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @second_session(i8* %28)
store i32 %29, i32* %3
br label %32
30: ; preds = %19
br label %31
31: ; preds = %30, %2
store i32 0, i32* %3
br label %32
32: ; preds = %31, %25, %14
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [15 x i8] c"pppoe-session1\00"
@.str.1 = [15 x i8] c"pppoe-session2\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @primary_session(i8* %11)
br label %21
13: ; preds = %4
%14 = load i8*, i8** %5
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 @second_session(i8* %19)
br label %21
21: ; preds = %2, %13, %17, %9
%22 = phi i32 [ %12, %9 ], [ %20, %17 ], [ 0, %13 ], [ 0, %2 ]
ret i32 %22
}