#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned long *, int *);
unsigned long setbit(unsigned long, int);
int main() {
  unsigned long x, y;
  int n;
  printf(
      "type a long unsigned x and an integer n: sets the nth bit of x to 1\n");
  while (1) {
    scanf("%lu %i", &x, &n);
    y = setbit(x, n);
    printf("%lu %i %lu\n", x, n, y);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <setbit@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xe98(%rip),%rbx
nop
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <scanf@plt>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%esi
call   1050 <setbit@plt>
mov    0x10(%rsp),%rsi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [69 x i8] c"type a long unsigned x and an integer n: sets the nth bit of x to 1\0A\00"
@.str.1 = [7 x i8] c"%lu %i\00"
@.str.2 = [12 x i8] c"%lu %i %lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %0, %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64* %2, i32* %4)
%8 = load i64, i64* %2
%9 = load i32, i32* %4
%10 = call i64 @setbit(i64 %8, i32 %9)
store i64 %10, i64* %3
%11 = load i64, i64* %2
%12 = load i32, i32* %4
%13 = load i64, i64* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %11, i32 %12, i64 %13)
br label %6
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%lu %i\00"
@.str.2 = [12 x i8] c"%lu %i %lu\0A\00"
@str = [68 x i8] c"type a long unsigned x and an integer n: sets the nth bit of x to 1\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64* %1, i32* %2)
%8 = load i64, i64* %1
%9 = load i32, i32* %2
%10 = call i64 @setbit(i64 %8, i32 %9)
%11 = load i64, i64* %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 %11, i32 %12, i64 %10)
br label %6
}