#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 atoi(char *);
int clickos_domid(char *);
int /*<<< orphan*/ clickos_stop(int, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int cmd_stop(int argc, char **argv) {
  int domid, configid;
  if (!(domid = strtol(argv[1], NULL, 10)))
    domid = clickos_domid(argv[1]);
  configid = atoi(argv[2]);
  clickos_stop(domid, configid);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1181 <cmd_stop+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <clickos_domid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <clickos_stop@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_stop>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    1167 <cmd_stop+0x27>
mov    0x8(%rbx),%rdi
call   1050 <clickos_domid@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <clickos_stop@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cmd_stop(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strtol(i8* %9, i32* null, i32 10)
store i32 %10, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @clickos_domid(i8* %15)
store i32 %16, i32* %5
br label %17
17: ; preds = %12, %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = call i32 @clickos_stop(i32 %22, i32 %23)
ret i32 0
}

LLVM IR (-O2):
define i32 @cmd_stop(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strtol(i8* nocapture %4, i32* null, i32 10)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = tail call i32 @clickos_domid(i8* %8)
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ %5, %2 ], [ %9, %7 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = tail call i32 @clickos_stop(i32 %11, i32 %14)
ret i32 0
}