#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int abort_decode_service_request(uint8_t *apdu, unsigned apdu_len,
                                 uint8_t *invoke_id, uint8_t *abort_reason) {
  int len = 0;
  if (apdu_len > 0) {
    if (invoke_id)
      *invoke_id = apdu[0];
    if (abort_reason)
      *abort_reason = apdu[1];
  }
  return len;
}


x86 assembly (clang, -O0):
<abort_decode_service_request>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    1158 <abort_decode_service_request+0x58>
cmpq   $0x0,-0x18(%rbp)
je     113b <abort_decode_service_request+0x3b>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1153 <abort_decode_service_request+0x53>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1158 <abort_decode_service_request+0x58>
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abort_decode_service_request>:
test   %esi,%esi
je     1117 <abort_decode_service_request+0x17>
test   %rdx,%rdx
je     110d <abort_decode_service_request+0xd>
mov    (%rdi),%eax
mov    %eax,(%rdx)
test   %rcx,%rcx
je     1117 <abort_decode_service_request+0x17>
mov    0x4(%rdi),%eax
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @abort_decode_service_request(i32* %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
store i32 0, i32* %9
%10 = load i32, i32* %6
%11 = icmp ugt i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %4
%13 = load i32*, i32** %7
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %7
store i32 %18, i32* %19
br label %20
20: ; preds = %15, %12
%21 = load i32*, i32** %8
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = load i32*, i32** %8
store i32 %26, i32* %27
br label %28
28: ; preds = %23, %20
br label %29
29: ; preds = %28, %4
%30 = load i32, i32* %9
ret i32 %30
}

LLVM IR (-O2):
define i32 @abort_decode_service_request(i32* nocapture %0, i32 %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = icmp eq i32* %2, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = load i32, i32* %0
store i32 %9, i32* %2
br label %10
10: ; preds = %8, %6
%11 = icmp eq i32* %3, null
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = getelementptr inbounds i32, i32* %0, i64 1
%14 = load i32, i32* %13
store i32 %14, i32* %3
br label %15
15: ; preds = %10, %12, %4
ret i32 0
}