#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 */
typedef int /*<<< orphan*/ bit_array;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int clear_bit(int bit_array[], unsigned bit_number) {
  int temp = 0;
  int ArraySize = 8 * sizeof(bit_array);
  if (bit_number > ArraySize - 1) {
    printf("the second parameter is too big! The set_bit function can not "
           "accept it!\n\n");
    return 0;
  }
  bit_array[bit_number] = 0;
  printf("After the process, the bit array is :");
  for (temp = 0; temp < ArraySize; temp++) {
    printf("%d", bit_array[temp]);
    if (temp == ArraySize - 1) {
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x40,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jbe    1158 <clear_bit+0x48>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d9 <clear_bit+0xc9>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movl   $0x0,(%rax,%rcx,4)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d2 <clear_bit+0xc2>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11bf <clear_bit+0xaf>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c4 <clear_bit+0xb4>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117b <clear_bit+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
push   %r15
push   %r14
push   %rbx
cmp    $0x40,%esi
jb     1148 <clear_bit+0x18>
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
jmp    1192 <clear_bit+0x62>
mov    %rdi,%r15
mov    %esi,%eax
movl   $0x0,(%rdi,%rax,4)
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebd(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x40,%rbx
jne    1170 <clear_bit+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [75 x i8] c"the second parameter is too big! The set_bit function can not accept it!\0A\0A\00"
@.str.1 = [38 x i8] c"After the process, the bit array is :\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @clear_bit(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 64, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %7
%10 = sub nsw i32 %9, 1
%11 = icmp ugt i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %42
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
store i32 0, i32* %18
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %20
20: ; preds = %38, %14
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %41
24: ; preds = %20
%25 = load i32*, i32** %4
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = sub nsw i32 %32, 1
%34 = icmp eq i32 %31, %33
br i1 %34, label %35, label %37
35: ; preds = %24
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %24
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %20
41: ; preds = %20
store i32 0, i32* %3
br label %42
42: ; preds = %41, %12
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str.1 = [38 x i8] c"After the process, the bit array is :\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [74 x i8] c"the second parameter is too big! The set_bit function can not accept it!\0A\00"
define i32 @clear_bit(i32* nocapture %0, i32 %1) {
%3 = icmp ugt i32 %1, 63
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
br label %19
6: ; preds = %2
%7 = zext i32 %1 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 0, i32* %8
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %10, %6
%11 = phi i64 [ 0, %6 ], [ %16, %10 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = icmp eq i64 %11, 63
%16 = add nuw nsw i64 %11, 1
br i1 %15, label %17, label %10
17: ; preds = %10
%18 = tail call i32 @putchar(i32 10)
br label %19
19: ; preds = %17, %4
ret i32 0
}