#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 /*<<< orphan*/ _panic(char *, int, char *, int);
int /*<<< orphan*/ _sleep(int /*<<< orphan*/);
int /*<<< orphan*/ check_if_gpio_legal(int);
int /*<<< orphan*/ put32(int, int);
void gpio_set(int n) {
  if (!check_if_gpio_legal(n)) {
    _panic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/Yradex/RaspberryPi3_OS/refs/heads/master/"
           "os/driver/gpio.c",
           44, "GPIO%d out of range", n);
  }
  put32((0xFFFFFF0000000000uL + 0x3F200000 + 0x0000001C) + 4 * (n / 32),
        1 << (n % 32));
  _sleep(0);
}


x86 assembly (clang, -O0):
<gpio_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <check_if_gpio_legal@plt>
cmp    $0x0,%eax
jne    1177 <gpio_set+0x37>
mov    -0x4(%rbp),%ecx
lea    0xe9a(%rip),%rdi
mov    $0x2c,%esi
lea    0xf22(%rip),%rdx
call   1040 <_panic@plt>
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
cltq
movabs $0xffffff003f20001c,%rcx
ff ff ff
add    %rcx,%rax
mov    %eax,%edi
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%esi
shl    %cl,%esi
call   1060 <put32@plt>
xor    %edi,%edi
call   1030 <_sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_set>:
push   %rbx
mov    %edi,%ebx
call   1050 <check_if_gpio_legal@plt>
test   %eax,%eax
jne    1166 <gpio_set+0x26>
lea    0xead(%rip),%rdi
lea    0xf3a(%rip),%rdx
mov    $0x2c,%esi
mov    %ebx,%ecx
call   1040 <_panic@plt>
lea    0x1f(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0x5,%eax
lea    0x3f20001c(,%rax,4),%edi
mov    $0x1,%esi
mov    %ebx,%ecx
shl    %cl,%esi
call   1060 <put32@plt>
xor    %edi,%edi
pop    %rbx
jmp    1030 <_sleep@plt>

LLVM IR (-O0):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Yradex/RaspberryPi3_OS/refs/heads/master/os/driver/gpio.c\00"
@.str.1 = [20 x i8] c"GPIO%d out of range\00"
define void @gpio_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @check_if_gpio_legal(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @_panic(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 32
%12 = mul nsw i32 4, %11
%13 = sext i32 %12 to i64
%14 = add i64 -1098452565988, %13
%15 = trunc i64 %14 to i32
%16 = load i32, i32* %2
%17 = srem i32 %16, 32
%18 = shl i32 1, %17
%19 = call i32 @put32(i32 %15, i32 %18)
%20 = call i32 @_sleep(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Yradex/RaspberryPi3_OS/refs/heads/master/os/driver/gpio.c\00"
@.str.1 = [20 x i8] c"GPIO%d out of range\00"
define void @gpio_set(i32 %0) {
%2 = tail call i32 @check_if_gpio_legal(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @_panic(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 44, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
%7 = sdiv i32 %0, 32
%8 = shl nsw i32 %7, 2
%9 = add nsw i32 %8, 1059061788
%10 = and i32 %0, 31
%11 = shl nuw i32 1, %10
%12 = tail call i32 @put32(i32 %9, i32 %11)
%13 = tail call i32 @_sleep(i32 0)
ret void
}