#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 usbdevfs_setinterface {
  int interface;
  int altsetting;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ USBDEVFS_SETINTERFACE;
int doioctl(int /*<<< orphan*/, struct usbdevfs_setinterface *, char *);
int set_interface(int iIf, int iAlt) {
  struct usbdevfs_setinterface SetIf = {0};
  SetIf.interface = iIf;
  SetIf.altsetting = iAlt;
  return doioctl(USBDEVFS_SETINTERFACE, &SetIf, "set_interface");
}


x86 assembly (clang, -O0):
<set_interface>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
lea    0xea2(%rip),%rdx
call   1040 <doioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_interface>:
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
mov    %edi,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rdx
lea    0x8(%rsp),%rsi
call   1030 <doioctl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.usbdevfs_setinterface = type { i32, i32, i32 }
@USBDEVFS_SETINTERFACE = global i32 0
@.str = [14 x i8] c"set_interface\00"
define i32 @set_interface(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.usbdevfs_setinterface
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast %struct.usbdevfs_setinterface* %5 to i8*
%7 = load i32, i32* %3
%8 = getelementptr inbounds %struct.usbdevfs_setinterface, %struct.usbdevfs_setinterface* %5, i32 0, i32 0
store i32 %7, i32* %8
%9 = load i32, i32* %4
%10 = getelementptr inbounds %struct.usbdevfs_setinterface, %struct.usbdevfs_setinterface* %5, i32 0, i32 1
store i32 %9, i32* %10
%11 = load i32, i32* @USBDEVFS_SETINTERFACE
%12 = call i32 @doioctl(i32 %11, %struct.usbdevfs_setinterface* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %12
}

LLVM IR (-O2):
%struct.usbdevfs_setinterface = type { i32, i32, i32 }
@USBDEVFS_SETINTERFACE = global i32 0
@.str = [14 x i8] c"set_interface\00"
define i32 @set_interface(i32 %0, i32 %1) {
%3 = alloca %struct.usbdevfs_setinterface
%4 = bitcast %struct.usbdevfs_setinterface* %3 to i8*
%5 = getelementptr inbounds %struct.usbdevfs_setinterface, %struct.usbdevfs_setinterface* %3, i64 0, i32 2
store i32 0, i32* %5
%6 = getelementptr inbounds %struct.usbdevfs_setinterface, %struct.usbdevfs_setinterface* %3, i64 0, i32 0
store i32 %0, i32* %6
%7 = getelementptr inbounds %struct.usbdevfs_setinterface, %struct.usbdevfs_setinterface* %3, i64 0, i32 1
store i32 %1, i32* %7
%8 = load i32, i32* @USBDEVFS_SETINTERFACE
%9 = call i32 @doioctl(i32 %8, %struct.usbdevfs_setinterface* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %9
}