#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 O_NDELAY;
int O_NOCTTY;
int O_RDWR;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char const *, int);
int main(int argc, char *argv[]) {
  int fd;
  const char *leds = "/dev/leds";
  fd = open(leds, O_RDWR | O_NOCTTY | O_NDELAY);
  ioctl(fd, atoi(argv[1]), atoi(argv[2]));
  close(fd);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    0x2e63(%rip),%rax
or     (%rax),%esi
mov    0x2e52(%rip),%rax
or     (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1030 <ioctl@plt>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e9d(%rip),%rcx
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    %rsi,%rbx
mov    0x2e70(%rip),%rcx
or     (%rcx),%eax
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1050 <open@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %eax,%edx
call   1030 <ioctl@plt>
mov    %ebp,%edi
call   1040 <close@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/leds\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i8*, i8** %7
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_NOCTTY
%11 = or i32 %9, %10
%12 = load i32, i32* @O_NDELAY
%13 = or i32 %11, %12
%14 = call i32 @open(i8* %8, i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
%24 = call i32 @ioctl(i32 %15, i32 %19, i32 %23)
%25 = load i32, i32* %6
%26 = call i32 @close(i32 %25)
ret i32 1
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/leds\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @O_RDWR
%4 = load i32, i32* @O_NOCTTY
%5 = or i32 %4, %3
%6 = load i32, i32* @O_NDELAY
%7 = or i32 %5, %6
%8 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = tail call i32 @ioctl(i32 %8, i32 %11, i32 %14)
%16 = tail call i32 @close(i32 %8)
ret i32 1
}