#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 usb_ctrlrequest {
  int bRequestType;
  int bRequest;
  int /*<<< orphan*/ wLength;
  int /*<<< orphan*/ wIndex;
  int /*<<< orphan*/ wValue;
};

/* Variables and functions */
int le16toh(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void handle_setup(const struct usb_ctrlrequest *setup) {
  printf("bRequestType = %d\n", setup->bRequestType);
  printf("bRequest     = %d\n", setup->bRequest);
  printf("wValue       = %d\n", le16toh(setup->wValue));
  printf("wIndex       = %d\n", le16toh(setup->wIndex));
  printf("wLength      = %d\n", le16toh(setup->wLength));
}


x86 assembly (clang, -O0):
<handle_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%edi
call   1040 <le16toh@plt>
mov    %eax,%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
call   1040 <le16toh@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <le16toh@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_setup>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%edi
call   1040 <le16toh@plt>
lea    0xed6(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rbx),%edi
call   1040 <le16toh@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x8(%rbx),%edi
call   1040 <le16toh@plt>
lea    0xed0(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.usb_ctrlrequest = type { i32, i32, i32, i32, i32 }
@.str = [19 x i8] c"bRequestType = %d\0A\00"
@.str.1 = [19 x i8] c"bRequest = %d\0A\00"
@.str.2 = [19 x i8] c"wValue = %d\0A\00"
@.str.3 = [19 x i8] c"wIndex = %d\0A\00"
@.str.4 = [19 x i8] c"wLength = %d\0A\00"
define void @handle_setup(%struct.usb_ctrlrequest* %0) {
%2 = alloca %struct.usb_ctrlrequest*
store %struct.usb_ctrlrequest* %0, %struct.usb_ctrlrequest** %2
%3 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %2
%4 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %2
%8 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %2
%12 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %11, i32 0, i32 4
%13 = load i32, i32* %12
%14 = call i32 @le16toh(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %2
%17 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %16, i32 0, i32 3
%18 = load i32, i32* %17
%19 = call i32 @le16toh(i32 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load %struct.usb_ctrlrequest*, %struct.usb_ctrlrequest** %2
%22 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %21, i32 0, i32 2
%23 = load i32, i32* %22
%24 = call i32 @le16toh(i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %24)
ret void
}

LLVM IR (-O2):
%struct.usb_ctrlrequest = type { i32, i32, i32, i32, i32 }
@.str = [19 x i8] c"bRequestType = %d\0A\00"
@.str.1 = [19 x i8] c"bRequest = %d\0A\00"
@.str.2 = [19 x i8] c"wValue = %d\0A\00"
@.str.3 = [19 x i8] c"wIndex = %d\0A\00"
@.str.4 = [19 x i8] c"wLength = %d\0A\00"
define void @handle_setup(%struct.usb_ctrlrequest* nocapture %0) {
%2 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %0, i64 0, i32 4
%9 = load i32, i32* %8
%10 = tail call i32 @le16toh(i32 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %0, i64 0, i32 3
%13 = load i32, i32* %12
%14 = tail call i32 @le16toh(i32 %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds %struct.usb_ctrlrequest, %struct.usb_ctrlrequest* %0, i64 0, i32 2
%17 = load i32, i32* %16
%18 = tail call i32 @le16toh(i32 %17)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %18)
ret void
}